Index of every page on this site: llms.txt
All skills
jame581 avatar

/localization

@426e8ab
by Jan Mesarčjame581/godotprompter979 stars
63
Run it yourself

Use when implementing localization (i18n/l10n) — TranslationServer, CSV/PO translation files, locale switching, RTL support, and pluralization in Godot 4.3+

Use this Skill: https://skilld.dev/gh/jame581/godotprompter/localization

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescsv-plural-context.md

≈610 tokens on demand. Your agent reads this file only when SKILL.md points to it.

← Back to SKILL.md

CSV Plural and Context Support (Godot 4.6+)

Godot 4.6 extends the CSV translation format with two optional header columns (?context, ?plural) and an optional ?pluralrule row, enabling features previously only available in PO files.

New CSV Columns and Rows

Addition Purpose
?context column Disambiguates identical keys with different meanings (e.g. "file" as a noun vs. "to file" as a verb)
?plural column The plural source string for that key (PO's msgid_plural); further plural forms go on the following rows, with an empty key
?pluralrule row (key in the first column) Optional per-locale gettext rule override, e.g. nplurals=2; plural=(n >= 2); in that locale's column

Example CSV with Context and Plural

Each locale column holds its first plural form on the key's row and one more form per continuation row. Czech has three forms, so it needs two continuation rows; English and German need one.

keys,?context,?plural,en,cs,de
ITEM_FILE,noun,,File,Soubor,Datei
ITEM_FILE,verb,,File,Uložit,Ablegen
ENEMY_COUNT,,ENEMY_COUNT_PLURAL,%d enemy,%d nepřítel,%d Feind
,,,%d enemies,%d nepřátelé,%d Feinde
,,,,%d nepřátel,

Using Context in Code

# Translate with context to disambiguate identical keys
var file_noun: String = tr("ITEM_FILE", "noun")    # "File" (object)
var file_verb: String = tr("ITEM_FILE", "verb")    # "File" (action)

# Without context there is no match: tr() returns the key itself ("ITEM_FILE")
var file_default: String = tr("ITEM_FILE")
// Translate with context
string fileNoun = Tr("ITEM_FILE", "noun");
string fileVerb = Tr("ITEM_FILE", "verb");

Using Plural in Code

# tr_n() picks the plural form for the current locale; you format the number in yourself.
var enemy_count := 3
var msg: String = tr_n("ENEMY_COUNT", "ENEMY_COUNT_PLURAL", enemy_count) % enemy_count
int enemyCount = 3;
string msg = TrN("ENEMY_COUNT", "ENEMY_COUNT_PLURAL", enemyCount).Replace("%d", enemyCount.ToString());

When to use PO vs CSV: CSV now covers context and plurals for any number of plural forms — add one continuation row per extra form. Control auto-translation skips context and plural rows, so translate those strings in code with tr() / tr_n(). PO remains the better fit for translator tooling and comments.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts7d3 checks · Risk SAFE
  • Gen Agent Trust Hub7d

    This skill is a comprehensive guide for implementing localization in Godot 4.3+. It covers core concepts, translation file formats (CSV and PO), runtime locale switching, RTL support, and pluralization. No security issues were detected.

  • Socket7d

    No alerts

  • Snyk7d

    Risk: LOW · No issues

Signed by skilld at 426e8ab. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 6 days ago.

Activeupdated last week

README badge

README badge for jame581/godotprompter/localization