Lesson 4 of 11
Localization: reaching other languages
Translate a Roblox game. Learn the localization table, automatic text capture and translation, parameters for dynamic text, Translator and FormatByKey in code, and how to test a second language in Studio.
By the end you can
- Read a localization table by its columns and say what Source, Context and Key are for
- Turn on automatic text capture and automatic translation, and say what they will not translate
- Rewrite a dynamic string as a key with a parameter and format it through a Translator
- Test a second language with the Player Emulator, using Locale, Pseudolocalize and Elongate
Before this: Publishing: versions, rollback, store page, UI fundamentals: ScreenGui, UDim2, layouts
1English, written into the code
Open Beacon Yard's HUD in a game running for a French player. It says Go to the beacon and hold E to start the drill. The text is in the script:
local IDLE_OBJECTIVE = "Go to the beacon and hold E to start the drill"
local ACTIVE_OBJECTIVE = "Survive and collect coins, swing the wrench at the drone"
local function renderClock()
local remaining = math.max(0, endsAt - workspace:GetServerTimeNow())
if phase == "Active" then
phaseLabel.Text = string.format("Active %.1fs", remaining)
objectiveLabel.Text = ACTIVE_OBJECTIVE
elseif phase == "Cooldown" then
phaseLabel.Text = "Cooldown"
objectiveLabel.Text = string.format("Next drill in %ds", math.max(0, math.ceil(remaining)))
else
phaseLabel.Text = "Idle"
objectiveLabel.Text = IDLE_OBJECTIVE
Roblox players come from many countries and speak many languages1. Every string above is English for all of them. Some lines are worse than they look: Next drill in %ds is built with string.format, so the finished sentence changes every second. A table of fixed sentences cannot hold it.

Select a numbered pin, or a row below, to read what it marks.
The HUD in Idle. Every piece of readable text here is English, written by the script.
Which pieces of the HUD in the picture are text a translator should handle?
Answer
Coins; Idle; Go to the beacon and hold E to start the drill. The three phrases are words in English. The 485 is data the game fills in, and it only needs correct number formatting, not translation.
Open this step in lesson mode · Link to this step · This confused me
2The localization table
Roblox's answer is a localization table stored on the cloud for your game2. Each row is one piece of text, with these columns:
| Column | What it is |
|---|---|
| Source | The text in your source language. Required. |
| Context | Optional. Names the object the text belongs to, so two uses of the same word can translate differently. |
| Example | Optional note for translators. |
| Key | Optional. A name your code can look up with Translator:FormatByKey. |
| Location | Filled in for you when a string is captured automatically. |
One rule keeps it sane: no two rows may share the same Source and Context, and no two may share a Key. You set one source language (Roblox supports one at a time) and pick the supported languages you want to add1.
| In the picture | In Roblox |
|---|---|
| A line in the phrasebook | One row of the localization table |
| The number beside the line | The Key that code looks up with FormatByKey |
| The same line in another language | The column for a supported language |
The table is a phrasebook with a key on every line. The game says "show me line 12 in Spanish" and the book gives back the Spanish sentence.
Think of it as A phrasebook with a key on every line
Match each column to its job.
Answer
Source: The text in your source language, required; Context: Tells two uses of the same word apart; Key: Lets code look an entry up by name; Location: Shows where an automatically captured string was found. Source is the only required field. Context separates identical sources, Key is for code lookups, and Location is written by automatic text capture.
Open this step in lesson mode · Link to this step · This confused me
3Let Roblox collect and translate
You do not have to type the table by hand. Automatic text capture collects text from UI objects as players (or you, in Studio) see it, and adds it to the table. Automatic translation then fills in blank entries for the languages you turned on3.
The steps:
- Creator Hub, your game, Audience, Localization: set the source language and add supported languages.
- Under Settings, turn on text capture, and turn on Use Translated Content.
- Under Languages, enable automatic translation for each language.
Three things to know. Automatic translation only fills blank entries and never overwrites a human translation. Manual translations are always shown to players, whatever their own setting. And it has quotas, counted per character and per language: translating "hello" into 10 languages counts as 50 characters3.
Capture only sees text objects whose AutoLocalize property is on. Switch it off on anything that must stay as written, such as a player name or a street sign3.
How many characters of automatic-translation quota does it use to translate the string Idle into 3 languages?
Answer
12 characters. Idle has 4 characters. 4 characters × 3 languages = 12.
Open this step in lesson mode · Link to this step · This confused me
4Dynamic text needs a parameter
Capture works on strings it sees. Next drill in 7s and Next drill in 6s are different strings, so a naive table would need a row for every number, forever. The fix is a parameter: one row whose Source has a named slot, written in braces with an optional format specifier4.
| Key | Source | fr |
|---|---|---|
Hud_NextDrill | Next drill in {Seconds:int}s | Prochain exercice dans {Seconds:int} s |
int prints a whole number without separators. Other specifiers include num (two decimals with thousands separators, for example 1,234.50 or 1234,50 depending on the language) and translate, which looks up another string4.
The code asks for the key and passes the values. You can test the idea in plain Luau:
local function format(template, args)
return (string.gsub(template, "{(%w+):?(%w*)}", function(name, kind)
local value = args[name]
if kind == "int" then
return string.format("%d", value)
end
return tostring(value)
end))
end
print(format("Next drill in {Seconds:int}s", { Seconds = 7 }))
print(format("Prochain exercice dans {Seconds:int} s", { Seconds = 7 }))
Next drill in 7s
Prochain exercice dans 7 sThis is a toy of what FormatByKey does for you, including every specifier. It also shows the real point: the number and the words travel separately, so each language can put them where it wants.
Why use one entry with {Seconds:int} instead of building the sentence in code and translating the pieces?
Answer
Languages order words differently, so the translator must control where the number goes. If code glues translated fragments together, it hard-codes English word order. A whole sentence with a slot lets each language place the number correctly.
Open this step in lesson mode · Link to this step · This confused me
5Where the phrasebook picture breaks
Client sideRemember: The localization table is a phrasebook with a key on every line.
A phrasebook only has sentences someone wrote down. A game builds sentences while it runs.
Where does it break?“A phrasebook with a key on every line” is a good picture of the localization table. Where does it stop being true?
It breaks here. A phrasebook only holds sentences someone wrote in advance, but a game builds sentences while it runs, such as a countdown with a changing number, a player's name or text a player types, none of which are lines in the book.
The true model. The table holds the strings you know ahead of time. Dynamic text uses a parameter slot in one entry so each language can place the value. Text players write or names should not go through the table; a real-time translation API exists for generated text and is in early development.
So a finished string like Next drill in 7s is not in the book, and neither is player-written text or a name. Free text needs a different tool: the real-time translation API, an Open Cloud call that translates a string on demand. The documentation marks it as early in development and subject to change5.
Which of these can a localization table handle well?
Answer
The fixed sentence Go to the beacon and hold E to start the drill. Fixed sentences fit. Countdowns need a parameter, and player text and names should not be translated through the table at all.
Open this step in lesson mode · Link to this step · This confused me
6Translate in code
For text a script sets, ask for a Translator. LocalizationService:GetTranslatorForPlayerAsync(player) yields and can fail, so wrap it in pcall and keep an English fallback6:
local LocalizationService = game:GetService("LocalizationService")
local Players = game:GetService("Players")
local ok, translator = pcall(function()
return LocalizationService:GetTranslatorForPlayerAsync(Players.LocalPlayer)
end)
local function nextDrillText(seconds: number): string
local whole = math.max(0, math.ceil(seconds))
local english = string.format("Next drill in %ds", whole)
if not ok then
return english
end
local good, text = pcall(function()
return translator:FormatByKey("Hud_NextDrill", { Seconds = whole })
end)
return if good then text else english
end
Two more details. FormatByKey throws when the key is missing, so it needs its own pcall too. And when a player changes language mid-game, a script that cached the translator should listen to the translator's LocaleId change and redraw6.
This HUD code can break the whole HUD for one player. Which line is the risk?
local translator = LocalizationService:GetTranslatorForPlayerAsync(Players.LocalPlayer)
local function label(seconds)
return translator:FormatByKey("Hud_NextDrill", { Seconds = seconds })
end
objective.Text = label(5)
Answer
Line 1: local translator = LocalizationService:GetTranslatorForPlayerAsync(Players.LocalPlayer). Fixed: local ok, translator = pcall(function() return LocalizationService:GetTranslatorForPlayerAsync(Players.LocalPlayer) end). GetTranslatorForPlayerAsync can fail, and without pcall the error stops the script. FormatByKey also needs a pcall and a fallback, but the first unprotected call is the first thing to break.
Open this step in lesson mode · Link to this step · This confused me
7Test a language without leaving Studio
You do not have to change your Roblox account language to see a translation. Studio's Player Emulator (Test menu, then turn on Enable Test Profile) has three options for this7:
- Locale emulates a language while you playtest.
- Pseudolocalize swaps letters for look-alikes, so
Bloxy Colabecomes something likeßℓôж¥ Çôℓá. Any text that stays plain English is not going through the translation system. - Elongate lengthens strings by a percentage you choose, to show where a longer translation will overflow a button.

Select a numbered pin, or a row below, to read what it marks.
The Player Emulator with the test profile on.
Build along
src/client/Hud.luausrc/client/ShopGui.luau
Open the Player Emulator from the Test menu and turn on Enable Test Profile.
You should see Output and the HUD look the same as before; Enable Test Profile shows as on.
Turn on Pseudolocalize and press Play.
You should see The HUD labels and shop buttons now show look-alike letters. Any label still in plain English is not being translated.
Turn Pseudolocalize off, set Elongate to 50 percent, and press Play again.
You should see Shop buttons such as Speed or Shield, and the objective sentence, get longer. Note which ones clip or wrap badly.
Add one French entry for the
Idlephase and choose French (fr-fr) as the emulated Locale. For a published game, add the row under Creator Hub, your game, Audience, Localization; to test locally in Studio without touching the cloud table, insert aLocalizationTableunderLocalizationServicein Explorer and add a row with SourceIdleand French translationEn attente.You should see With a French translation entered for Idle, picking French (fr-fr) in Locale shows it in the HUD.

Select a numbered pin, or a row below, to read what it marks.
With Pseudolocalize on, translated labels change. The plain English HUD text is not going through the translation system.
With Pseudolocalize on, the shop title shows look-alike letters, but the Coins label still reads plain Coins. What does that tell you?
Answer
The Coins label is not going through the translation system, perhaps because it is set in a way capture misses. Text that stays plain English is not being localized. Check its AutoLocalize property and how the script sets it.
Open this step in lesson mode · Link to this step · This confused me
8How studios localize
Other ways pros do this
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| Automatic text capture and translation | Roblox collects strings and machine-translates blank entries. | Early on, small teams, and long-tail languages. | Quality varies, monthly quotas apply, and it misses dynamic and player text. |
| Manual translations in the table | You or translators add entries in the Translator Portal or by CSV upload. | Your top languages and anything with tone, jokes or brand terms. | Slower and costs money or time; always shown to players. |
| Work with translators | Invite native speakers as collaborators on the localization table. | Languages that matter to your audience. | Needs briefs, context notes and review. |
| Real-time translation API | An Open Cloud call that translates a string on demand. | Player-written or generated text, if you accept the preview status. | Early in development and subject to change; needs a server round trip. |
Order the localization work for a new game.
Answer
1. Move HUD strings into keys, with parameters for numbers 2. Check the layout with Pseudolocalize and Elongate 3. Turn on automatic capture and translation for a few languages 4. Replace machine translations in your top languages with human ones. Fix the strings first, test the layout cheaply, let automation provide a first draft, then spend human effort where players are.
Open this step in lesson mode · Link to this step · This confused me
9Challenges
Level 1, Apprentice
Challenge
List what a translator would have to handle in the HUD and the shop.
- Start from
- The game at milestone m06 (download)
Done means
- A list of every English string the HUD and shop create
- Each marked as a fixed sentence, a parameter string, or data only
Hints
- Search Hud.luau and ShopGui.luau for quotation marks and string.format.
- Names and numbers are data.
Level 2, Builder
Challenge
Run both emulator tests on the shop and write up what broke.
- Start from
- The game at milestone m06 (download)
Done means
- A screenshot or note for each of Pseudolocalize and Elongate at 50 percent
- A list of every label that stayed English or clipped
Hints
- Use the BuildAlong above.
- Check the shop buttons: they combine a name and a price.
Why test with Elongate before you have a single translation?
Answer
Translations are often longer than English, so you find clipped buttons early. Elongate stretches strings to imitate longer translations, so layout problems show up before translators are involved.
Level 3, Professional
Challenge
Start from the m14-ship tag in the game repo, then make the countdown translatable in challenges/localization_work.luau. The test uses a fake translator, so no published table is needed.
Press Play and run this in the server command bar:
game.ServerScriptService.RunGameTests:Invoke("localization")
- Start from
- The game at milestone m14 (download)
- Grade it
- In Studio, press Play, then run
game.ServerScriptService.RunGameTests:Invoke("localization")in the server command bar. Copy the pass code from Output.
Done means
- nextDrillText asks the translator for Hud_NextDrill with a Seconds parameter rounded up
- It falls back to the English line with no translator, and when FormatByKey throws
- A late tick shows 0, never a negative number
- challenges/localization.luau prints TEST PASS for all seven cases
Hints
- Round up with math.ceil before you pass the value.
- Wrap the FormatByKey call in pcall and return the English line on failure.
Open this step in lesson mode · Link to this step · This confused me
10Recap
Retiring the analogy
You no longer need “a phrasebook with a key on every line”. The table holds the strings you know ahead of time. Dynamic text uses a parameter slot in one entry so each language can place the value. Text players write or names should not go through the table; a real-time translation API exists for generated text and is in early development.
Recap
- The localization table has a row per string: Source, optional Context and Key, and Location from capture.
- Automatic capture and translation give a quick first draft; human translations always win, quotas apply per character and language.
- Use parameters for dynamic text, pcall every translator call, and test with Locale, Pseudolocalize and Elongate.
The localization table is a phrasebook with a key on every line, until a phrasebook only holds sentences someone wrote in advance, but a game builds sentences while it runs, such as a countdown with a changing number, a player's name or text a player types, none of which are lines in the book.
Queued for review
- Match each column to its job.
- How many characters of automatic-translation quota does it use to translate the string Idle into 3 languages?
- Why use one entry with {Seconds:int} instead of building the sentence in code and translating the pieces?
- Which of these can a localization table handle well?
- With Pseudolocalize on, the shop title shows look-alike letters, but the Coins label still reads plain Coins. What does that tell you?
Open this step in lesson mode · Link to this step · This confused me