Command Palette

Search for a command to run...

Назад к скиллам
скилл № 63147

game-localization

Covers localizing a browser game written in TypeScript: string tables with stable IDs, plurals and formatting through the Intl API, message format choice…

БесплатноЗапускает вложенные скрипты
fcsouzaот fcsouza★ 29 звёзд на GitHub

Установить game-localization в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Game localization

Internationalize from the first string: externalize text, format through Intl, and turn on a pseudo locale. Translation comes later and costs far less when the code is ready for it.

Strings: IDs, comments, whole messages

  1. Keep every player-facing string in a resource file per language. Hard-coded text sends translators into source code, where they can break it (IGDA). The client bundle and any server renderer read the same catalog files.
  2. Key messages by stable semantic IDs (quest.ruins.offer, hud.gold.label), not by the English text. One English string can need different translations: Mozilla's example is "bookmark" as noun and verb, and Godot notes the same ambiguity with plain-English source strings, as opposed to message codes.
  3. When a string's meaning changes, give it a new ID, so old translations stop matching and translators see it as new (Mozilla). Fixing a typo keeps the ID.
  4. Never reuse one string in two places. A noun and a verb that look the same in English get two entries (Mozilla).
  5. Give each message a translator comment: where it shows, what each placeholder holds, what must stay untranslated, and a length budget for fixed-size UI. Keep it in the catalog next to the message, not in code the translator never sees. Fluent binds a comment placed right above a message to it, and tools show both together.
  6. Never build a sentence from fragments. Write one message with named placeholders, so translators can reorder the pieces (ICU, Mozilla). Ban template-literal sentences such as `${name} found ${n} ${item}` in client and server code.
  7. When an inserted part cannot agree with the fixed text (item names in loot toasts, quest names in log lines), use a topic-comment layout: "Picked up: {item}", not "You picked up a {item}". The fixed text then needs no gender or number agreement (W3C).
  8. Inside plural or select messages, write a full sentence in each branch. Put select outside and nest plural inside it (ICU).
  9. Prefer repeating text across messages to sharing fragments. Use variants only for grammar, and separate messages for UI logic (Fluent good practices).
  10. Keep brand names and glossary terms as referenced terms, so one change updates every message (Fluent terms).

Copy boilerplate/string-table.ts when you need a typed string table: IDs typed from the source table, a comment and optional length budget on every entry, plural messages that require other, the fallback chain below, catalogs loaded in parallel, and failed loads recorded in loadErrors instead of failing the whole table. Its {name} placeholders and plural maps are a minimal stand-in, not ICU MessageFormat. Move to a real message format when a message needs gender or nested choices.

Locale fallback chain

Resolve from most to least specific, then the default locale: zh-Hans-CN, zh-CN, zh-Hans, zh, then en. Unreal processes cultures in that order. Add the likely script for a tag that has only a region, so zh-TW reaches a zh-Hant catalog (zh-TW, zh-Hant-TW, zh-Hant, then en). Skip the bare language when its likely script differs from the requested one: a bare zh catalog is usually Simplified and a bare sr one Cyrillic, so zh-TW and sr-Latn must not fall back to them. That skip is this skill's rule. The boilerplate does both with Intl.Locale.prototype.maximize(). Unity lets each locale list its fallbacks. Godot falls back to a project fallback locale, or to en.

  • Treat regional variants as separate locales: pt and pt-BR, es and es-419, zh-Hans and zh-Hant. Steam lists Portuguese and Portuguese-Brazil, and Spanish-Spain and Spanish-Latin America, as separate languages.
  • Use BCP 47 tags inside the game. Convert at the platform edge: Steam's API codes map brazilian to pt-BR, latam to es-419, schinese to zh-CN.
  • Resolve the chain once per message ID when the catalogs load, and log misses and failed loads in development. The boilerplate does both.
  • Intl throws RangeError on an invalid tag, currency code or time zone. On a server, parse the Accept-Language header, resolve it against the list of locales you ship, and pass only a shipped locale to the translator and the format helpers. Never pass a raw header value: distinct tags would also grow formatter caches. The boilerplate's cache keys on the locale's base name and holds at most 256 formatters (this skill's default).
  • Format plurals and numbers with the locale the text came from. A Russian player who falls back to English text should not get Russian plural categories applied to English branches.

Plurals and formatting: use Intl

Do not hard-code singular and plural. CLDR gives English one and other; Russian and Polish one, few, many and other; Arabic all six categories; Japanese only other. Brazilian Portuguese (pt) and French put 0 in one; European Portuguese (pt-PT) does not. Every plural or select message needs a default branch: other in ICU syntax, * in Fluent.

Need Intl member Note
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • boilerplate/intl-format.ts
  • boilerplate/pseudo-localize.ts
  • boilerplate/string-table.ts
  • references/process.md
  • references/sources.md
  • references/text-layout.md

FAQ

Что делает скилл game-localization?

Covers localizing a browser game written in TypeScript: string tables with stable IDs, plurals and formatting through the Intl API, message format choice, text expansion, canvas text, right-to-left and CJK layout, fonts, pseudo-localization and the translation process. Use when a game will ship in more than one language, when you add dialogue, HUD labels, quest text or other player-facing strings that will be translated, or when text overflows, wraps badly or shows the wrong plural in another language.

Как установить скилл game-localization?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл game-localization запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить game-localization с