Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when implementing localization (i18n/l10n) — TranslationServer, CSV/PO translation files, locale switching, RTL support, and pluralization in Godot 4.3+
.claude/skills/jame581-localization/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 76% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 39% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 6% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 383% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 73% | 0% |
All examples target Godot 4.3+ with no deprecated APIs; GDScript first, then C#.
> Related skills: godot-ui for Control nodes and theme management, save-load for persisting language settings, responsive-ui for layout adjustments per locale.
tr() — Godot's translation functionTranslation resourcesTranslationServer.set_locale()All Control nodes with text, tooltip_text, or placeholder_text properties auto-translate when the value matches a translation key.
| Strategy | Example Key | Pros | Cons | |----------|-------------|------|------| | Semantic keys | MENU_START_GAME | Clear intent, easy to find | Needs a default language fallback | | English-as-key | Start Game | Readable code, no mapping file for English | Breaks if English text changes |
> Recommendation: Use semantic keys (MENU_START_GAME) for production; English-as-key only for prototypes or solo projects.
The simplest format. First column is the key, subsequent columns are locale codes.
csvkeys,en,cs,de,ja MENU_START,Start Game,Začít hru,Spiel starten,ゲームスタート MENU_OPTIONS,Options,Nastavení,Optionen,オプション MENU_QUIT,Quit,Ukončit,Beenden,終了 PLAYER_HEALTH,Health: %d,Zdraví: %d,Gesundheit: %d,体力: %d ITEM_COLLECTED,%s collected!,%s sebráno!,%s gesammelt!,%sを入手!
Save as translations.csv in your project. Godot auto-detects the format on import.
Import settings (Import dock):
Industry-standard format, preferred by translation teams and tools like Poedit, Weblate, Crowdin.
Create a POT template (messages.pot):
msgid "MENU_START"
msgstr ""
msgid "MENU_OPTIONS"
msgstr ""
msgid "MENU_QUIT"
msgstr ""
msgid "PLAYER_HEALTH"
msgstr ""Create locale files (e.g., cs.po for Czech):
msgid "MENU_START"
msgstr "Začít hru"
msgid "MENU_OPTIONS"
msgstr "Nastavení"
msgid "MENU_QUIT"
msgstr "Ukončit"
msgid "PLAYER_HEALTH"
msgstr "Zdraví: %d"Project Settings → Localization → Translations → Add... → select your .csv or .po files.
Or register at runtime:
gdscriptvar translation := load("res://translations/cs.po") as Translation TranslationServer.add_translation(translation)
csharpvar translation = GD.Load<Translation>("res://translations/cs.po"); TranslationServer.AddTranslation(translation);
> ⚠️ Changed in Godot 4.7: OptimizedTranslation.generate() now returns bool (was void). GDScript- and C#-source-compatible, but binary-incompatible — recompile precompiled C# plugins calling it. See the 4.7 migration guide.
A custom EditorTranslationParserPlugin can override _customize_strings() — called once after all files are parsed during POT generation — to add or remove entries from the final extracted-string list:
gdscript@tool extends EditorTranslationParserPlugin func _customize_strings(strings: Array[PackedStringArray]) -> Array[PackedStringArray]: strings.append(PackedStringArray(["Test 1", "context", "test 1 plurals", "test 1 comment"])) # Drop internal strings that begin with "$". return strings.filter(func(s): return not s[0].begins_with("$"))
csharp#if TOOLS using System.Linq; using Godot; public partial class CommentAwareParser : EditorTranslationParserPlugin { public override Godot.Collections.Array<string[]> _CustomizeStrings(Godot.Collections.Array<string[]> strings) { strings.Add(new[] { "Test 1", "context", "test 1 plurals", "test 1 comment" }); // Drop internal strings that begin with "$". return new Godot.Collections.Array<string[]>(strings.Where(s => !s[0].StartsWith("$"))); } } #endif
> Godot 4.7+: The POT generator also extracts Control.accessibility_name and accessibility_description, making accessibility strings translatable without manual listing. (GH-117134)
gdscript# Basic translation var label_text: String = tr("MENU_START") # "Start Game" or translated equivalent # With format arguments var health_text: String = tr("PLAYER_HEALTH") % current_health # "Health: 85" or "Zdraví: 85" # With string arguments var collected_text: String = tr("ITEM_COLLECTED") % item_name # "Sword collected!" or "Meč sebráno!" # Pluralization (Godot 4.x) var count := 5 var msg: String = tr_n("ONE_ENEMY", "MANY_ENEMIES", count) # Requires PO files with plural forms
csharpstring labelText = Tr("MENU_START"); string healthText = string.Format(Tr("PLAYER_HEALTH"), currentHealth); // Pluralization string msg = TrN("ONE_ENEMY", "MANY_ENEMIES", count);
Label, Button, RichTextLabel, and other Control nodes auto-translate their text property when it matches a translation key. Set the text to the key:
Button.text = "MENU_START" → displays "Start Game" (en) or "Začít hru" (cs)> Tip: To disable automatic translation on a specific Control, set auto_translate_mode to DISABLED.
> Godot 4.7+: Control.translation_context: StringName sets a per-control translation context, used both to translate displayed text and to generate translation templates — the property equivalent of tr()'s context argument (C#: TranslationContext). (GH-115340)
gdscript# Switch language func set_language(locale_code: String) -> void: TranslationServer.set_locale(locale_code) # All Control nodes with translation keys update automatically # Get current locale var current: String = TranslationServer.get_locale() # e.g. "en", "cs", "de" # Get available locales var locales: PackedStringArray = TranslationServer.get_loaded_locales()
csharppublic void SetLanguage(string localeCode) { TranslationServer.SetLocale(localeCode); } string current = TranslationServer.GetLocale();
gdscriptextends Control @onready var language_button: OptionButton = %LanguageButton var _locales: Array[Dictionary] = [ {"code": "en", "name": "English"}, {"code": "cs", "name": "Čeština"}, {"code": "de", "name": "Deutsch"}, {"code": "ja", "name": "日本語"}, ] func _ready() -> void: for locale in _locales: language_button.add_item(locale["name"]) # Set current selection var current_locale: String = TranslationServer.get_locale() for i in _locales.size(): if _locales[i]["code"] == current_locale: language_button.selected = i break language_button.item_selected.connect(_on_language_selected) func _on_language_selected(index: int) -> void: TranslationServer.set_locale(_locales[index]["code"]) # Save preference — SettingsManager is a user-created autoload (see save-load skill) SettingsManager.set_setting("general", "locale", _locales[index]["code"])
Arabic, Hebrew, and Persian need layout_direction on Controls (LOCALE auto-follows the current locale), structured_text_type so URLs and paths do not fully reverse, and a font covering the script — Godot's default font does not. Re-apply layout direction whenever the locale changes. TranslationServer has no signals — override _notification and watch for NOTIFICATION_TRANSLATION_CHANGED (defined on MainLoop, inherited by Node). Since you never subscribe, there is no handler to disconnect.
Full recipes, per-control property table, BBCode for mixed direction, and the C# LocaleAwarePanel: references/rtl-support.md
GDScript has no locale-aware number or date formatting — "%d" % 1234567 is always 1234567, so you group digits by hand. C# does have it: look up a CultureInfo from TranslationServer.GetLocale() (swap _ for -) and use ToString("N"/"C"/"d", culture).
Both helpers in full: references/locale-formatting.md
res://
├── translations/
│ ├── game.csv # Main game translations
│ ├── ui.csv # UI-specific translations
│ └── items.csv # Item names and descriptions
├── fonts/
│ ├── default_font.ttf # Latin, Cyrillic
│ └── cjk_font.ttf # Chinese, Japanese, Korean
└── themes/
└── default_theme.tres # Font assignments per locale# Category_Context_Description
MENU_MAIN_START # Main menu, start button
MENU_MAIN_QUIT # Main menu, quit button
HUD_HEALTH_LABEL # In-game HUD, health label
DIALOGUE_NPC_GREETING # NPC dialogue, greeting line
ITEM_SWORD_NAME # Inventory item name
ITEM_SWORD_DESC # Inventory item description| Symptom | Cause | Fix | |---------|-------|-----| | Translation key shows instead of text | Translation file not registered in Project Settings | Add to Project Settings → Localization → Translations | | Text doesn't update on locale switch | Using string literals instead of tr() | Wrap all user-facing strings in tr() | | Label shows key after scene change | Translation resource not loaded yet | Register translations in Project Settings (not at runtime) | | RTL text renders LTR | layout_direction not set | Set to RTL or LOCALE on root Control | | Font doesn't display characters | Missing Unicode range in font | Import a font covering the target script (Noto Sans recommended) | | Pluralization doesn't work with CSV | CSV doesn't support plural forms | Use PO format for languages with complex plural rules | | %s in translation shows literal %s | Using tr() result as key instead of formatting it | Use tr("KEY") % value, not tr("KEY" % value) |
Godot 4.5 adds a Preview Language dropdown under Project Settings → Internationalization: the editor viewport re-renders in any registered locale, so you catch overflow from longer translations and verify RTL layout without entering Play mode. Editor-only — it does not affect exported builds.
Steps and QA benefits: references/editor-preview.md
Godot 4.6 extends CSV translation with three optional header columns — ?context, ?plural, ?pluralrule — bringing context disambiguation and simple one/other plurals (previously PO-only) to CSV. Languages with 3+ plural forms (Russian, Polish, Arabic) still need PO format with full msgstr[n] plural arrays.
Column reference, example CSV, and tr() / tr_n() usage (GDScript + C#): references/csv-plural-context.md.
tr() (or are set as translation keys on Control nodes)TranslationServer.set_locale()layout_direction set to RTL or LOCALE on root UI containers%s, %d) are applied AFTER tr(), not before?context column used when the same key has different meanings in different UI contexts (Godot 4.6+)?plural / ?pluralrule columns used for simple one/other plurals; PO format used for 3+ plural forms (Godot 4.6+)| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 15,502 | 9,119 | -41% | 1 | 1 | 0% | 2,951 | 5,193 | +76% | 0 | 0 | — |
case-02 | pass→pass | 9,098 | 8,677 | -5% | 1 | 1 | 0% | 1,710 | 5,129 | +200% | 0 | 0 | — |
case-03 | fail→pass | 18,247 | 4,770 | -74% | 1 | 1 | 0% | 3,095 | 4,290 | +39% | 0 | 0 | — |
case-04 | pass→pass | 8,286 | 5,528 | -33% | 1 | 1 | 0% | 1,497 | 4,438 | +196% | 0 | 0 | — |
case-05 | pass→pass | 16,271 | 8,934 | -45% | 1 | 1 | 0% | 2,622 | 5,218 | +99% | 0 | 0 | — |
case-06 | pass→pass | 6,391 | 3,956 | -38% | 1 | 1 | 0% | 1,255 | 4,149 | +231% | 0 | 0 | — |
case-07 | fail→pass | 25,150 | 6,086 | -76% | 1 | 1 | 0% | 4,326 | 4,584 | +6% | 0 | 0 | — |
case-08 | pass→pass | 13,042 | 9,352 | -28% | 1 | 1 | 0% | 2,566 | 5,400 | +110% | 0 | 0 | — |
case-09 | pass→pass | 12,414 | 10,837 | -13% | 1 | 1 | 0% | 2,339 | 5,673 | +143% | 0 | 0 | — |
case-10 | pass→pass | 15,695 | 5,512 | -65% | 1 | 1 | 0% | 2,618 | 4,391 | +68% | 0 | 0 | — |
case-11 | fail→pass | 5,249 | 4,847 | -8% | 1 | 1 | 0% | 898 | 4,337 | +383% | 0 | 0 | — |
case-12 | fail→pass | 14,259 | 3,923 | -72% | 1 | 1 | 0% | 2,367 | 4,102 | +73% | 0 | 0 | — |
case-13 | fail→pass | 11,810 | 5,553 | -53% | 1 | 1 | 0% | 1,875 | 4,456 | +138% | 0 | 0 | — |
case-14 | pass→pass | 16,736 | 8,773 | -48% | 1 | 1 | 0% | 2,520 | 4,728 | +88% | 0 | 0 | — |
case-15 | pass→pass | 6,073 | 2,828 | -53% | 1 | 1 | 0% | 1,054 | 3,923 | +272% | 0 | 0 | — |
case-16 | pass→pass | 4,250 | 2,935 | -31% | 1 | 1 | 0% | 651 | 3,933 | +504% | 0 | 0 | — |
case-17 | pass→pass | 4,017 | 2,994 | -25% | 1 | 1 | 0% | 626 | 3,954 | +532% | 0 | 0 | — |
case-18 | pass→pass | 12,375 | 10,018 | -19% | 1 | 1 | 0% | 2,078 | 5,122 | +146% | 0 | 0 | — |
case-19 | pass→pass | 12,823 | 15,398 | +20% | 1 | 1 | 0% | 2,942 | 6,992 | +138% | 0 | 0 | — |
case-20 | pass→pass | 11,204 | 12,216 | +9% | 1 | 1 | 0% | 2,053 | 5,968 | +191% | 0 | 0 | — |
case-21 | pass→pass | 11,099 | 12,164 | +10% | 1 | 1 | 0% | 2,326 | 6,121 | +163% | 0 | 0 | — |
case-22 | pass→fail | 12,114 | 8,949 | -26% | 1 | 1 | 0% | 2,467 | 5,243 | +113% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.