InstanceLocaleLoader
Owns the lazy per-locale loading state for an instance-decoded JSONTranslator (a folder of per-locale JSON StringValues / ModuleScripts): which locales are available, which have already been loaded, and the accumulated entry lookup.
Decodes and writes a locale's entries to the TranslatorService only the first time that locale is needed. The service is resolved from the ServiceBag passed to the constructor, so callers never have to thread a writer through each load call.
Functions
new
InstanceLocaleLoader.new(translatorName: string,sourceLocaleId: string,--
always loaded, the fallback for every key
) → InstanceLocaleLoaderLoadSourceLocale
Loads the source locale. Always call this first -- it establishes the Source/Context that other locales' values merge onto, and it is the ultimate fallback for every key.
LoadAllLocales
Loads every available locale file. Used off the client, where there is no single target locale to narrow to.
LoadLocale
InstanceLocaleLoader.LoadLocale(localeId: string--
the target locale
) → ()
Loads every available locale file that shares the target's language (e.g. for "es-mx":
both es and es-mx; for "fr-fr": every fr-* file), so a regional player gets the
universal-language strings and same-language siblings as fallbacks before dropping to
the source. The source locale is ensured first. Idempotent -- a file already loaded is
never decoded or written again -- and returns nothing, since the caller does not (and
should not) care which files it touched.