Skip to main content

TranslatorService

Handles selecting the right locale/translator for Studio, and Roblox games.

Functions

SetForcedLocaleId

TranslatorService.SetForcedLocaleId(
localeIdstring?
) → ()

Forces the locale id used for translation, overriding the inferred player/Roblox locale. Pass nil to clear the override and fall back to the inferred locale. Useful for an in-game language selector.

SetEntryValue

TranslatorService.SetEntryValue(
translationKeystring,
sourcestring,
contextstring,
localeIdstring,
textstring
) → ()

Queues a localization table entry value write. Writes are batched and flushed together at the end of the frame (via task.defer) instead of being applied synchronously, so a burst of translators loading does not each pay the cost of mutating (and re-replicating) the shared localization table in the load path.

A key is therefore not readable the instant it is registered. Gate reads on TranslatorService.ObserveIsTranslationReady, which tracks the key you are about to read rather than whichever batch happened to be pending.

Registering what the table already holds is free: the write is dropped before it queues, so it neither schedules a flush nor takes the key not-ready. Re-registering unchanged text is the common case rather than the exception.

SetEntryExample

TranslatorService.SetEntryExample(
translationKeystring,
sourcestring,
contextstring,
examplestring
) → ()

Queues a localization table entry example write. See TranslatorService.SetEntryValue.

IsEntryRegistered

TranslatorService.IsEntryRegistered(
translationKeystring,
sourcestring,
localeIdstring,
textstring
) → boolean

Whether the table already carries this key with this source text, whatever context it was registered under.

This is the question JSONTranslator.ToTranslationKey asks before registering, and it is deliberately blind to context: a key loaded from a locale file and the same key minted at runtime describe themselves differently ("Generated from X with key Y" vs "automatic.Y") while meaning the same thing. Rewriting the context changes nothing a reader can observe, and there is no targeted call that lands metadata on its own -- so it would cost a full table rebuild (see TranslatorService._mergePendingEntries) for every authored line the first time it appeared on screen.

Takes the same arguments as TranslatorService.SetEntryValue minus the context it ignores, and in the same order. Worth keeping that way: at the only call site the source and the text are the same string, so a transposition would type-check, pass these asserts, and read correctly.

AddLocaleLoader

TranslatorService.AddLocaleLoader(
loaderLocaleLoader
) → () → ()

Registers a translator's locale loader, so something that needs every locale can reach all of them (TranslatorService.PromiseLoadAllLocales). Returns a function that unregisters it -- give it to the maid of whatever owns the loader.

PromiseLoadAllLocales

TranslatorService.PromiseLoadAllLocales(selfTranslatorService) → Promise<()>

Loads every locale of every registered translator into this realm's table, and resolves once those writes have landed.

Nothing in normal operation wants this: a translator loads the source language plus whichever one a player reads, which is the whole point of loading lazily. The CSV export is the exception -- it needs every language in one table at one moment -- so it asks for them here rather than every realm carrying them the whole session on the chance an export happens. See TranslatorCmdrService.

PromiseEntriesWritten

TranslatorService.PromiseEntriesWritten(selfTranslatorService) → Promise

Returns a promise that resolves once all currently-queued localization writes have been flushed to the table. Resolves immediately if nothing is pending.

This answers for the batch pending when it is called, which is not necessarily the batch carrying the data a reader wants: writes queued while this flush resolves land in the next one. Gate reads on TranslatorService.ObserveIsTranslationReady instead -- this is for callers that want the current batch settled, such as tests.

IsTranslationReady

TranslatorService.IsTranslationReady(
translationKeystring
) → boolean

Whether a read of this key would see everything queued for it. False while the key has writes waiting on the end-of-frame flush.

WARNING

This is an implementation detail of the translation stack, exposed for diagnostics. Reading a translation through JSONTranslator already accounts for it.

A key nothing has ever queued is ready: there is nothing pending to wait for, and a read should fall through to whatever the translators can offer rather than block forever.

IsTranslationReadyForLocale

TranslatorService.IsTranslationReadyForLocale(
translationKeystring,
localeIdstring
) → boolean

Whether a read of this key in this locale would see everything queued for it. Narrower than TranslatorService.IsTranslationReady, which is false while any locale is queued -- though only barely, in practice. The fallback set below includes the table's source locale, and nearly every queued entry carries a source-locale value (the loaders write the source file first, minting writes en), so the two answers differ only for an entry queued exclusively in a locale this one cannot read through.

WARNING

This is an implementation detail of the translation stack, exposed for diagnostics.

The distinction matters after a single-key flush (TranslatorService.FlushEntryForKey), which lands the locales a read can consult but leaves the entry queued for the rest. The key is readable in that locale while still not ready overall, so a failure to translate it is a real failure and worth reporting.

Readable means readable the way a translator reads: every locale a read of this locale may fall back through has to have landed, not just the exact locale asked about. Loaders key their data under the language ("en"), while a player's locale is normally a regional variant ("en-us"), so asking about the regional locale alone would call every queued key ready -- its pending values are under the language it would fall back to.

ObserveIsTranslationReady

TranslatorService.ObserveIsTranslationReady(
translationKeystring
) → Observable<boolean>

Observes whether a read of this key would see everything queued for it, firing the current state immediately and again on every change.

WARNING

This is an implementation detail of the translation stack, exposed for diagnostics. Every way of reading a translation through JSONTranslator already waits for the key it reads, so consumers should not have to gate on this themselves.

This is the reactive counterpart to the batching: writes are deliberately deferred to the end of the frame (see TranslatorService.SetEntryValue), so a reader that translates the instant a key is registered reads before the write lands. Rather than forcing the flush -- which would defeat the batching that keeps a streaming-in game from writing the table thousands of times a frame -- JSONTranslator observes this and re-reads when it goes ready.

Emissions are driven by the queue and flush directly, so nothing here yields.

FlushEntriesForTesting

TranslatorService.FlushEntriesForTesting(selfTranslatorService) → ()

Flushes every pending localization write synchronously. This defeats the end-of-frame batching and pays the full table write cost, so it exists for tests that need the table settled immediately. Production synchronous reads should use TranslatorService.FlushEntryForKey to land just the key they need.

FlushEntryForKey

TranslatorService.FlushEntryForKey(
translationKeystring
) → ()

Lands only what a synchronous read of a single key actually needs, leaving the rest of the batch queued for the normal end-of-frame flush. This lets a synchronous read (JSONTranslator.FormatByKey) guarantee the one key it reads is present without forcing -- and paying for -- the whole pending batch early.

Only the locales a read can actually consult are landed (the example and every other locale in the entry stay queued), so a read costs a handful of targeted writes rather than one per locale in the entry.

GetLocalizationWriteCount

TranslatorService.GetLocalizationWriteCount(selfTranslatorService) → number

Returns the total number of raw mutating calls made to the localization table. Each such call invalidates every AutoLocalize entry in the engine, so this is the cost we want to keep low. Primarily useful for diagnostics and regression tests.

GetLocalizationRebuildCount

TranslatorService.GetLocalizationRebuildCount(selfTranslatorService) → number

Returns how many of those writes were full-table SetEntries rebuilds, which additionally re-serialize every entry in the table. A flush picks between rebuilding and landing targeted writes, so this is how a test tells which path a batch took.

ObserveTranslator

TranslatorService.ObserveTranslator(selfTranslatorService) → Observable<Translator>

Observes Roblox translator

PromiseTranslator

TranslatorService.PromiseTranslator(selfTranslatorService) → Observable<Translator>

Promises the Roblox translator

GetTranslator

TranslatorService.GetTranslator(selfTranslatorService) → Translator?

Gets the current translator to use

ObserveLocaleId

TranslatorService.ObserveLocaleId(selfTranslatorService) → Observable<string>

Observes the current locale id for this translator.

GetLocaleId

TranslatorService.GetLocaleId(selfTranslatorService) → string

Gets the localeId to use

Show raw api
{
    "functions": [
        {
            "name": "SetForcedLocaleId",
            "desc": "Forces the locale id used for translation, overriding the inferred player/Roblox\nlocale. Pass nil to clear the override and fall back to the inferred locale. Useful\nfor an in-game language selector.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "localeId",
                    "desc": "",
                    "lua_type": "string?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 186,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "SetEntryValue",
            "desc": "Queues a localization table entry value write. Writes are batched and flushed\ntogether at the end of the frame (via `task.defer`) instead of being applied\nsynchronously, so a burst of translators loading does not each pay the cost of\nmutating (and re-replicating) the shared localization table in the load path.\n\nA key is therefore not readable the instant it is registered. Gate reads on\n[TranslatorService.ObserveIsTranslationReady], which tracks the key you are about to read\nrather than whichever batch happened to be pending.\n\nRegistering what the table already holds is free: the write is dropped before it queues, so\nit neither schedules a flush nor takes the key not-ready. Re-registering unchanged text is\nthe common case rather than the exception.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "source",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "context",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "localeId",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "text",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 212,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "SetEntryExample",
            "desc": "Queues a localization table entry example write. See [TranslatorService.SetEntryValue].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "source",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "context",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "example",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 249,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_getPendingEntry",
            "desc": "Returns the pending delta for a key, and whether this call is what made the key pending\n(the caller announces that, once the write it is making has actually been stored).",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "source",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "context",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(PendingEntry, boolean)"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 283,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_getEntryCache",
            "desc": "The mirror of a table's entries, built from the table the first time anything needs it.",
            "params": [
                {
                    "name": "_self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "localizationTable",
                    "desc": "",
                    "lua_type": "LocalizationTable"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "EntryCache"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 317,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "IsEntryRegistered",
            "desc": "Whether the table already carries this key with this source text, whatever context it was\nregistered under.\n\nThis is the question [JSONTranslator.ToTranslationKey] asks before registering, and it is\ndeliberately blind to context: a key loaded from a locale file and the same key minted at\nruntime describe themselves differently (\"Generated from X with key Y\" vs \"automatic.Y\")\nwhile meaning the same thing. Rewriting the context changes nothing a reader can observe,\nand there is no targeted call that lands metadata on its own -- so it would cost a full\ntable rebuild (see [TranslatorService._mergePendingEntries]) for every authored line the\nfirst time it appeared on screen.\n\nTakes the same arguments as [TranslatorService.SetEntryValue] minus the context it ignores,\nand in the same order. Worth keeping that way: at the only call site the source and the text\nare the same string, so a transposition would type-check, pass these asserts, and read\ncorrectly.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "source",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "localeId",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "text",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 357,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_getCurrentEntry",
            "desc": "The entry the table currently holds for a key, or nil when it holds none -- or when the key\nhas a delta queued, which makes it mid-change: the flush decides what the table ends up\nwith, so nothing may be concluded from what is there now.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "LocalizationEntry?"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 386,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_isEntryValueCurrent",
            "desc": "Whether the table already holds exactly this value, making the write nothing but cost.\n\nRe-registering unchanged text is the common case rather than the exception: minting a\ntranslation key ([JSONTranslator.ToTranslationKey]) registers its source text every time a\nlabel is built, and a loader re-queues a locale it has already loaded. Queuing such a write\nwould schedule a flush, and -- because the key goes not-ready and back -- drive a\nre-translation pass through every reader of that key, all to write back what is there.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "source",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "context",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "localeId",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "text",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 411,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_isEntryExampleCurrent",
            "desc": "Whether the table already holds exactly this example. See [TranslatorService._isEntryValueCurrent].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "source",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "context",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "example",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 439,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "AddLocaleLoader",
            "desc": "Registers a translator's locale loader, so something that needs *every* locale can reach\nall of them ([TranslatorService.PromiseLoadAllLocales]). Returns a function that\nunregisters it -- give it to the maid of whatever owns the loader.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "loader",
                    "desc": "",
                    "lua_type": "LocaleLoader"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "() -> ()"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 462,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "PromiseLoadAllLocales",
            "desc": "Loads every locale of every registered translator into this realm's table, and resolves\nonce those writes have landed.\n\nNothing in normal operation wants this: a translator loads the source language plus\nwhichever one a player reads, which is the whole point of loading lazily. The CSV export\nis the exception -- it needs every language in one table at one moment -- so it asks for\nthem here rather than every realm carrying them the whole session on the chance an export\nhappens. See [TranslatorCmdrService].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<()>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 484,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "PromiseEntriesWritten",
            "desc": "Returns a promise that resolves once all currently-queued localization writes\nhave been flushed to the table. Resolves immediately if nothing is pending.\n\nThis answers for the batch pending when it is called, which is not necessarily the batch\ncarrying the data a reader wants: writes queued while this flush resolves land in the\nnext one. Gate reads on [TranslatorService.ObserveIsTranslationReady] instead -- this is for\ncallers that want the current batch settled, such as tests.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 509,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "IsTranslationReady",
            "desc": "Whether a read of this key would see everything queued for it. False while the key has\nwrites waiting on the end-of-frame flush.\n\n:::warning\nThis is an implementation detail of the translation stack, exposed for diagnostics.\nReading a translation through [JSONTranslator] already accounts for it.\n:::\n\nA key nothing has ever queued is ready: there is nothing pending to wait for, and a read\nshould fall through to whatever the translators can offer rather than block forever.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 532,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "IsTranslationReadyForLocale",
            "desc": "Whether a read of this key **in this locale** would see everything queued for it. Narrower\nthan [TranslatorService.IsTranslationReady], which is false while any locale is queued --\nthough only barely, in practice. The fallback set below includes the table's source locale,\nand nearly every queued entry carries a source-locale value (the loaders write the source\nfile first, minting writes `en`), so the two answers differ only for an entry queued\n*exclusively* in a locale this one cannot read through.\n\n:::warning\nThis is an implementation detail of the translation stack, exposed for diagnostics.\n:::\n\nThe distinction matters after a single-key flush ([TranslatorService.FlushEntryForKey]),\nwhich lands the locales a read can consult but leaves the entry queued for the rest. The\nkey is readable in that locale while still not ready overall, so a failure to translate it\nis a real failure and worth reporting.\n\nReadable means readable the way a translator reads: every locale a read of this locale may\nfall back through has to have landed, not just the exact locale asked about. Loaders key\ntheir data under the language (\"en\"), while a player's locale is normally a regional variant\n(\"en-us\"), so asking about the regional locale alone would call every queued key ready --\nits pending values are under the language it would fall back to.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "localeId",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 565,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_getReadLocales",
            "desc": "The locales a read for this locale may consult, without repeats: the locale itself and the\ntable's source locale, each plus its bare language subtag, since the Roblox translator falls\na regional locale back to its language (e.g. en-us -> en, and the loaders key the source\nunder \"en\").",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "localeId",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ string }"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 604,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "ObserveIsTranslationReady",
            "desc": "Observes whether a read of this key would see everything queued for it, firing the\ncurrent state immediately and again on every change.\n\n:::warning\nThis is an implementation detail of the translation stack, exposed for diagnostics. Every\nway of reading a translation through [JSONTranslator] already waits for the key it reads,\nso consumers should not have to gate on this themselves.\n:::\n\nThis is the reactive counterpart to the batching: writes are deliberately deferred to the\nend of the frame (see [TranslatorService.SetEntryValue]), so a reader that translates the\ninstant a key is registered reads before the write lands. Rather than forcing the flush --\nwhich would defeat the batching that keeps a streaming-in game from writing the table\nthousands of times a frame -- [JSONTranslator] observes this and re-reads when it goes\nready.\n\nEmissions are driven by the queue and flush directly, so nothing here yields.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 638,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_fireTranslationReady",
            "desc": "Tells a key's observers about a readiness change. The state is read per observer rather\nthan captured once: a handler earlier in the fan-out can re-queue the key, and handing the\nobservers after it a value that is already false would leave them believing the key landed.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 688,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "FlushEntriesForTesting",
            "desc": "Flushes every pending localization write synchronously. This defeats the end-of-frame\nbatching and pays the full table write cost, so it exists for tests that need the table\nsettled immediately. Production synchronous reads should use\n[TranslatorService.FlushEntryForKey] to land just the key they need.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 712,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "FlushEntryForKey",
            "desc": "Lands only what a synchronous read of a single key actually needs, leaving the rest of\nthe batch queued for the normal end-of-frame flush. This lets a synchronous read\n([JSONTranslator.FormatByKey]) guarantee the one key it reads is present without forcing\n-- and paying for -- the whole pending batch early.\n\nOnly the locales a read can actually consult are landed (the example and every other\nlocale in the entry stay queued), so a read costs a handful of targeted writes rather\nthan one per locale in the entry.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "translationKey",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 730,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_landEntryLocale",
            "desc": "Writes one locale's value for a pending entry straight to the table and dequeues just\nthat locale, so the deferred batch flush does not write it again. No-ops if the entry has\nnothing pending for the locale.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "localizationTable",
                    "desc": "",
                    "lua_type": "LocalizationTable"
                },
                {
                    "name": "entry",
                    "desc": "",
                    "lua_type": "PendingEntry"
                },
                {
                    "name": "localeId",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 766,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "GetLocalizationWriteCount",
            "desc": "Returns the total number of raw mutating calls made to the localization table. Each\nsuch call invalidates every AutoLocalize entry in the engine, so this is the cost we\nwant to keep low. Primarily useful for diagnostics and regression tests.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 827,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "GetLocalizationRebuildCount",
            "desc": "Returns how many of those writes were full-table `SetEntries` rebuilds, which additionally\nre-serialize every entry in the table. A flush picks between rebuilding and landing\ntargeted writes, so this is how a test tells which path a batch took.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 838,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_applyPendingEntries",
            "desc": "Merges the pending entry deltas into the table's entries and writes back whatever actually\nchanged, by whichever route is cheaper for the size of the batch: a handful of targeted\nSetEntryValue/SetEntryExample calls, or one SetEntries that rebuilds the table.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "pendingEntries",
                    "desc": "",
                    "lua_type": "PendingEntries"
                }
            ],
            "returns": [],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 906,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_reconcileEntryCache",
            "desc": "Rebuilds the mirror from what the table actually holds, with this batch's merged entries\nkept on top. Anything a foreign writer added or changed is adopted; the keys in this batch\nwin, since the table has not been told about their new values yet.",
            "params": [
                {
                    "name": "_self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "localizationTable",
                    "desc": "",
                    "lua_type": "LocalizationTable"
                },
                {
                    "name": "cache",
                    "desc": "",
                    "lua_type": "EntryCache"
                },
                {
                    "name": "pendingEntries",
                    "desc": "",
                    "lua_type": "PendingEntries"
                }
            ],
            "returns": [],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 961,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_shouldWriteIndividually",
            "desc": "Whether to land this many targeted writes rather than rebuild the whole table. One\nSetEntries costs one invalidation plus re-serializing every entry; N targeted writes cost N\ninvalidations and re-serialize nothing. See INVALIDATION_ENTRY_COST.",
            "params": [
                {
                    "name": "_self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "writeCount",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "entryCount",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 1005,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "_mergePendingEntries",
            "desc": "Merges the deltas into the mirror and returns the targeted writes that would bring the\ntable in line with it, or nil when the batch cannot be expressed as targeted writes at all\nand has to go through SetEntries.",
            "params": [
                {
                    "name": "_self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                },
                {
                    "name": "cache",
                    "desc": "",
                    "lua_type": "EntryCache"
                },
                {
                    "name": "pendingEntries",
                    "desc": "",
                    "lua_type": "PendingEntries"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ PendingWrite }?"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 1023,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "ObserveTranslator",
            "desc": "Observes Roblox translator",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Translator>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1099,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "PromiseTranslator",
            "desc": "Promises the Roblox translator",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Translator>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1108,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "GetTranslator",
            "desc": "Gets the current translator to use",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Translator?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1148,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "ObserveLocaleId",
            "desc": "Observes the current locale id for this translator.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<string>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1157,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        },
        {
            "name": "GetLocaleId",
            "desc": "Gets the localeId to use",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TranslatorService"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1204,
                "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "TranslatorService",
    "desc": "Handles selecting the right locale/translator for Studio, and Roblox games.",
    "source": {
        "line": 7,
        "path": "src/clienttranslator/src/Shared/TranslatorService.lua"
    }
}