Skip to content
AI in game dev

AI and game dev · · 7 min read

AI game localization workflow: translate strings without breaking UI

A workflow for machine-translating game text: extraction, glossary, length limits, plurals and checks, plus what breaks in Japanese, German and Arabic.

Title One button, four languages, with four buttons of the same size reading Settings in English, Einstellungen in German, a short Japanese word, and an Arabic word. The German one overflows its box and is outlined in red.

How do you translate a game with AI without breaking it?

Treat the AI as a fast first draft inside a pipeline, not as the translator of record. The pipeline has six steps: extract strings with keys, add a glossary and context, draft, run automatic checks, have a native speaker review, and play the game in each language. The step people skip is the fifth, and it is the one that catches meaning errors.

The checks matter most when a draft is fast and plausible, because a wrong translation reads fine to someone who does not speak the language. The animation follows one string through the pipeline. Its first German draft drops the {price} placeholder, the check catches it, and the string goes back to the draft step.

One policy point before you start. Steam's Content Survey lists localization among the content that counts when AI made it, so machine-translated text that ships is something you describe there. See the Steam AI disclosure rules.

Animation of a string moving through six numbered stations: extract, glossary, draft, checks, native review and play test. A German draft missing the price placeholder is stopped at checks and sent back to draft, then passes.
A string that fails the placeholder check goes back to the draft step.

How do you extract strings so they can be translated?

Give every string a key, and keep whole sentences together. Never build a sentence by gluing pieces: word order differs between languages, so "You found " + n + " coins" cannot be translated. Use one string with named placeholders, as the Godot internationalization docs recommend, so translators can reorder them: "{player} picked up the {item}".

Godot reads translations from spreadsheets (CSV) or gettext PO files. The gettext guide lists what PO adds: one file per language, which works better with Git, tools like Poedit and Weblate, plural forms, and a context field to separate identical English words. The cost is a more complex format. For a game with a few hundred strings, CSV is fine. If you need plurals in Arabic or Russian, use PO.

In Godot, generate the template under Project > Project Settings > Localization > Template Generation. Mark names that must not be translated with Auto Translate > Mode set to Disabled in the Inspector. Add a TRANSLATORS: comment above any string that needs a note.

What goes in the glossary and the context?

A model translates each string well in isolation and inconsistently across a game. The glossary and the context fix that. Send both with every batch.

The glossary is a table of terms you want fixed: character names, items, currency, UI verbs such as Continue. It has the source term, the approved translation per language, and a note such as "do not translate". The context goes in a column next to each string: where it appears (button, tooltip, dialogue), who speaks, the tone, and the maximum length.

Ask for output as rows keyed by string id, not free text, and tell the model to copy placeholders and anything in backticks unchanged. Then check that it did. Models rewrite things you told them not to touch often enough that a script check is cheaper than finding it later.

  • Source string and key
  • Where it appears and who says it
  • Maximum length in characters or pixels
  • Tone and form of address (formal or informal)
  • Glossary terms it contains

How long can the translated text be?

Plan for longer text in German and shorter text in Japanese, and test pixels, not characters. W3C's article on text size in translation reports that short English strings expand most: IBM's guidelines, which it cites, give 200 to 300 percent for strings up to 10 characters and 130 percent for strings over 70. Its Flickr example has the word "views" becoming "-mal angesehen" in German, 2.8 times as long.

In the 7-string sample table used for this guide, German averaged 1.16 times the English length in characters and peaked at 1.62 times, for "Settings" becoming "Einstellungen". Japanese averaged 0.53 times. Arabic averaged 0.96 times. Characters are only a first filter. At 38 px in a 240 px button, "Spiel starten" measured 235 px and overflowed, while the Japanese text fit at 189 px.

Fix it in the layout, not the translation: let labels grow, wrap, or shrink, and keep fixed boxes for icons. In Godot, turn on pseudolocalization in the Project Settings (advanced) to see accented, longer text in your own UI before any translator is involved. It cannot check CJK or right-to-left fonts, according to the docs, so test those with real text.

Animation of three menu buttons in a 240 pixel box cycling through English, German, Japanese and Arabic. German Spiel starten and Einstellungen turn red and read 235 and 253 pixels, too wide. The other languages fit.
Text widths measured at 38 px in the browser that rendered the image. Your font will give different numbers.

How do plurals work in other languages?

English has two forms, "1 day" and "2 days". Japanese has one. German has two. Russian has three for whole numbers and a fourth for fractions. Arabic has six. The Unicode CLDR plural rules chart defines them, and the animation shows which category each number falls in.

So "{n} days" cannot be one string with an s on the end. Use tr_n with a PO file and let each language define its forms. The snippet below ran in Godot 4.5.1 and printed 11 -> 11 يومًا and 100 -> 100 يوم: Arabic uses a different noun form for 3 to 10 and for 11 to 99.

A model can write all six forms if you ask for them explicitly, one per plural category. Check them with a speaker. It is the part of Arabic most likely to be silently wrong.

# ar.po (plural entry, Arabic has six forms)
"Plural-Forms: nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5);\n"
msgid "{n} day"
msgid_plural "{n} days"
msgstr[0] "لا أيام"
msgstr[1] "يوم واحد"
msgstr[2] "يومان"
msgstr[3] "{n} أيام"
msgstr[4] "{n} يومًا"
msgstr[5] "{n} يوم"

# GDScript
TranslationServer.add_translation(load("res://ar.po"))
TranslationServer.set_locale("ar")
print(tr_n("{n} day", "{n} days", 11).format({"n": 11}))
Animated grid of plural categories for the numbers 0, 1, 2, 3, 5, 11, 22 and 100 in English, German, Japanese, Russian and Arabic. English and German show one and other, Japanese shows only other, Russian shows one, few and many, Arabic shows zero, one, two, few, many and other.
Plural category per number, from the CLDR rules. Integers only.

What goes wrong in Japanese, German and Arabic?

**Japanese**: no spaces between words, so the engine needs data to know where lines can break. Godot's docs say to enable Include Text Server Data under Project Settings > General > Internationalization > Locale before you export. Fonts matter too: the default font covers only part of Latin-1, so add a multilingual font such as Noto as a fallback. Counters depend on the object, so "{n} {item}" templates break. Choose a politeness level and put it in the glossary.

**German**: compound nouns do not wrap, so a long word can overflow even when the line has room. Articles and endings change with the item's gender and case, so "the {item}" is wrong for some items. Write the string so the item sits in a position where its form does not change. Choose du or Sie once.

**Arabic**: the UI mirrors. Godot mirrors anchors, margins, text alignment and container order for right-to-left locales, but not sprites or the game world, and you can override it with the layout_direction property. Letters join, so never split or truncate a word in code. Verbs can agree with the speaker's gender, and {player} does not tell the translator which. Add a gender field if your characters have one.

Two shop menus side by side. The English one has a back arrow, icons and text on the left and a progress bar filling from the left. The Arabic one is mirrored, with the arrow, icons and text on the right and the bar filling from the right.
A mirrored layout. Godot does most of this for you; sprites and the world stay as they are.

How do you check the translations before release?

Run a script over the table first. The one used here is about 30 lines of Python: it compares placeholders with the source, flags empty cells, and checks length against a per-language budget. The report shows it catching a lost {price} and a typo in {item}. Run it on every new batch, since models make mistakes at random, not always in the same place.

Then pay a native speaker to read the whole thing in the running game, not in a spreadsheet: tone, jokes and gendered forms only show up in context. In Godot, View > Preview Translation shows a scene in a chosen language, the Locale > Test setting in Project Settings runs the whole game in one, and godot --language de does the same from the command line. Clear the test setting before you commit.

Budget for it. If you cannot afford a review for a language, think hard about shipping it: a bad translation can cost you more than a missing language. Other release steps are in the Steam release checklist, and AI tools beyond translation are covered in the overview of AI tools in game development.

Terminal output of a Python check. The first run reports 7 strings, average length ratios for German, Japanese and Arabic, and one too-long German string. The second run adds a lost price placeholder in German and a misspelled item placeholder in Japanese.
Real output of loc_check.py on the sample table, then with two mistakes added.

Questions people ask

Can AI translate a game well enough to ship?
It can produce a good first draft. Ship it only after a native speaker has read it in the running game, because errors in tone, gender and plurals look fine to anyone who does not speak the language.
Which languages need extra work in a game UI?
Right-to-left languages like Arabic need a mirrored layout, Japanese and Chinese need fonts and line-break data, and German needs room for longer words. Plurals need care in Arabic and Russian.
Do I have to disclose machine-translated text on Steam?
Steam's Content Survey names localization as content that counts when AI produced it. If AI-translated text ships, you describe it there.

Sources and further reading