API reference

LocalizedAssetResolver Object

Framework-level localized asset resolver that transparently redirects asset URIs to locale-specific variants when available.
Uses the convention of inserting a locale directory before the filename: path/to/asset.glb ->path/to/fr/asset.glb (when locale is French)
Fallback chain: language_country -> language -> default (original path). English is treated as the default locale and incurs no filesystem checks.
This resolver is opt-in. Apps that do not call LocalizedAssetResolver.initialize see no behavior change.
Example:
// In your Activity.onCreate()
LocalizedAssetResolver.initialize(this)
// Then use assets normally — localization is automatic:
entity.setComponent(Mesh(Uri.parse("models/cube.glb")))
// On a French device with models/fr/cube.glb present -> loads French version
// Otherwise -> loads models/cube.glb (default)

Signature

object LocalizedAssetResolver

Methods

clearCache ()
Clears the resolution and existence caches. Call after locale changes.
Signature
fun clearCache()
disable ()
Disables localized asset resolution.
Signature
fun disable()
initialize ( context , locale )
Initializes the localized asset resolver. Must be called before localization takes effect.
Signature
fun initialize(context: Context, locale: Locale? = null)
Parameters
context: Context  The Android context (activity or application)
locale: Locale?  Optional locale override. If null, uses Locale.getDefault().
isEnabled ()
Returns whether the resolver is currently enabled and initialized.
Signature
fun isEnabled(): Boolean
Returns
Boolean
resolve ( uri )
Resolves a URI to its localized variant if one exists.
Resolves apk://, pak://, and relative (no scheme) URIs. All other schemes (mesh://, gfx://, http://, https://, file://) are returned unchanged.
For pak://<name>/<path> URIs, locale variants are looked up inside the same mounted pak (no cross-pak fallback). Mount name is preserved.
Signature
fun resolve(uri: Uri): Uri
Parameters
uri: Uri  The original asset URI
Returns
Uri  The localized URI, or the original if no localized variant exists
resolveAssetPath ( assetPath )
Resolves a raw asset path string to its localized variant via the AssetManager (apk://).
For pak://-resident assets, prefer the LocalizedAssetResolver.resolve overload that takes a Uri so the mount name is preserved.
Signature
fun resolveAssetPath(assetPath: String): String
Parameters
assetPath: String  The original asset path string
Returns
String  The localized path, or the original if no localized variant exists
setLocale ( locale )
Sets a locale override, useful for testing or user-driven language switching. Clears the resolution cache so new requests use the updated locale.
Signature
fun setLocale(locale: Locale)
Parameters
locale: Locale