localization-pack-generator
Paste into Claude Code, Claude.ai, the desktop app, or the browser extension — ⌘/Ctrl+V. ✓ Copied. Switch to Claude and paste — ⌘/Ctrl+V.
Localization Pack Generator
Convert English source copy into a translation-ready pack for a target locale. The output is structured for direct import into the target CMS or TMS (Phrase, Lokalise, Crowdin), with cultural adaptation notes, placeholder integrity checks, and character expansion budget warnings so translators know what constraints apply before they start.
Usage
/localization-pack-generator <source file or directory>
--locale <locale-code>
[--format json|xliff12|xliff20|sitecore|optimizely|umbraco]
[--expand-budget]
[--notes]
Examples:
/localization-pack-generator src/locales/en.json --locale fr-CA --format json/localization-pack-generator content/en/ --locale de --format xliff12 --notes/localization-pack-generator src/locales/en.json --locale ja --expand-budget --format json
Supported locale codes (common)
| Code | Language / Region |
|---|---|
fr-CA |
French — Canada |
fr-FR |
French — France |
de |
German — Germany |
es-ES |
Spanish — Spain |
es-MX |
Spanish — Mexico |
ja |
Japanese |
zh-CN |
Chinese Simplified |
zh-TW |
Chinese Traditional |
pt-BR |
Portuguese — Brazil |
nl |
Dutch |
it |
Italian |
ko |
Korean |
ar |
Arabic (RTL — flag layout impact) |
he |
Hebrew (RTL — flag layout impact) |
pl |
Polish |
sv |
Swedish |
Phase 1 — Source file intake
Read the source file(s). Detect format automatically:
- JSON — flat
{ "key": "value" }or nested i18n objects (next-intl, i18next, react-intl) - XLIFF 1.2 / 2.0 — TMS export format
- Markdown — standalone copy files from
brand-voice-copy-generatoroutput - CSV / TSV — spreadsheet exports
Extract:
- All translatable string keys and their English source values
- Any
{{placeholder}},{variable},%s,%(name)spatterns — these must survive translation intact - Any ICU MessageFormat pluralisation patterns — flag these for translator context
- Any HTML tags embedded in strings — flag; translators must preserve them
Count strings and produce an inventory summary before generating the pack.
Phase 2 — Character expansion budget
Different languages expand English source copy at different rates. When --expand-budget is
set (or when targeting Japanese, German, Finnish, or Arabic), calculate expansion budgets for
every string that has a known character limit.
| Target locale | Typical expansion over English | Notes |
|---|---|---|
German (de) |
+30–35% | Compound nouns; long verbs |
French (fr-*) |
+15–25% | Gendered articles; formal register |
Spanish (es-*) |
+15–25% | Inflected verbs |
Italian (it) |
+10–25% | Similar to Spanish |
Dutch (nl) |
+20–30% | Long compounds |
Polish (pl) |
+20–30% | Inflected endings |
Japanese (ja) |
−10–20% (chars) | Kanji compression; but line breaks differ |
Chinese (zh-*) |
−20–30% (chars) | Very compact; line length looks short |
Arabic (ar) |
+20–30% | RTL layout; also right-aligns numerals |
Hebrew (he) |
−5–10% | RTL; shorter words |
For each string with a CMS character limit, compute:
budget = limit - (english_length × expansion_factor)
Flag strings where the expansion budget leaves fewer than 10 characters of headroom — these need translator instructions to be concise.
Phase 3 — Cultural adaptation notes
When --notes is set, produce per-locale cultural notes in the <note> element (XLIFF) or
a _notes sidecar JSON. These are guidance for human translators or review of AI translation.
Common adaptation topics by locale
fr-CA vs fr-FR:
- Vocabulary differences: "courriel" (CA) vs "email" (FR); "magasiner" (CA) vs "faire du shopping" (FR)
- Tone: Québec French skews more informal in marketing copy; France French skews formal
- Currency: Canadian dollars vs euros; ensure
{currency}placeholders are not hardcoded
de:
- Formal "Sie" vs informal "du" — enterprise software defaults to "Sie"; consumer apps often use "du"
- Compound nouns: translators may need to hyphenate for short CMS fields
- CTA style: German CTAs are often longer; flag short-CTA fields (< 20 chars)
ja:
- Honorific register (keigo) — enterprise and financial content uses formal keigo
- Katakana for foreign tech terms (e.g. "サービス" for "service")
- No spaces between words — character count is reliable but line-break logic differs
ar / he (RTL locales):
- Flag all layout-impacting strings (navigation labels, CTA buttons, form labels)
- Note that numbers and dates may need locale-aware formatting (not just translation)
- OG images and hero images with embedded English text need locale variants
es-MX vs es-ES:
- Pronoun: MX uses "tú" (informal) and "ustedes" (plural formal); ES uses "vosotros" (plural informal)
- Vocabulary: "computadora" (MX) vs "ordenador" (ES); "carro" (MX) vs "coche" (ES)
Phase 4 — Pack generation
Format: json (default)
Flat key-value JSON. Values are machine-translated placeholders unless --translate flag is
passed (requires external TMS integration — not in scope here; flag this clearly).
{
"_meta": {
"sourceLocale": "en",
"targetLocale": "fr-CA",
"generatedAt": "[ISO-8601]",
"stringCount": 42,
"translationStatus": "source-copy-ready-for-translation"
},
"auth.login.email.label": "Email address",
"auth.login.email.placeholder": "name@company.com",
"auth.login.submit.label": "Sign in"
}
When --notes is set, produce a companion [locale].notes.json:
{
"auth.login.submit.label": {
"characterLimit": 20,
"expansionBudget": 7,
"note": "CTA label — keep short; imperative verb required. de: use 'Anmelden'. fr-CA: 'Se connecter' (13 chars, PASS)."
}
}
Format: xliff12
XLIFF 1.2 — compatible with Sitecore Translation Provider (SDL Trados, Lionbridge), Phrase, and most enterprise TMS platforms.
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" target-language="fr-CA"
datatype="plaintext" original="en.json"
date="[ISO-8601]">
<header>
<note>Character limits and expansion budgets in trans-unit notes.</note>
</header>
<body>
<trans-unit id="auth.login.email.label" approved="no">
<source>Email address</source>
<target state="new">Email address</target>
<note>Form field label. Limit: 40 chars. Expansion budget (fr-CA +20%): 33 chars.</note>
</trans-unit>
</body>
</file>
</xliff>
Format: xliff20
XLIFF 2.0 — for modern TMS platforms (Lokalise, Crowdin). Same structure adapted to the 2.0 schema.
Format: sitecore
Produces an XML sitecore package structure compatible with the Sitecore Translation Provider and Language Fallback item export. Mirrors the Sitecore item field path structure.
<languages>
<language Name="fr-CA">
<item id="{...}" key="auth-login-email-label">
<field id="{...}" name="Value">
<content>Adresse courriel</content>
</field>
</item>
</language>
</languages>
Format: optimizely
Produces a fr-CA.xml language file in the Optimizely LangFolder format:
<?xml version="1.0" encoding="utf-8"?>
<languages>
<language name="French (Canada)" id="fr-CA">
<auth>
<login>
<emaillabel>Adresse courriel</emaillabel>
</login>
</auth>
</language>
</languages>
Format: umbraco
Produces a JSON export structured for Umbraco Dictionary items + Language Variants:
{
"locale": "fr-CA",
"dictionaryItems": [
{
"key": "Auth.Login.Email.Label",
"value": "Adresse courriel",
"sourceValue": "Email address",
"note": "Form field label."
}
]
}
Phase 5 — QA pre-flight
Before delivering the pack, run these checks:
- All source strings are present in the pack (no missing keys)
- All placeholder patterns (
{{var}},{var},%s) are preserved in target strings - ICU plural patterns are flagged for translator attention
- HTML tags within strings are preserved and uncorrupted
- RTL locales (ar, he) are flagged for layout impact review
- Strings with expansion headroom < 10 chars are flagged
- No
_noteskeys have been accidentally included as translatable strings - XLIFF
<target state>attributes are set to"new"(not"translated"— TMS sets this)
Reference
See reference.md for:
- Full locale code list with expansion rates
- Placeholder pattern reference (ICU, printf, Handlebars, i18next)
- CMS language configuration notes (Sitecore Language Fallback, Optimizely Language Branches, Umbraco Language Variants)
- TMS integration patterns (Phrase webhooks, Lokalise CLI, Crowdin API)
Technical details
- Plugin
- copy-localization-generator
- Author
- Dakota Smith
- Skill name
localization-pack-generator- Maturity
- experimental
- Security review
- No security review
- Owners
-
- design
- strategy
- Argument hint
<source file or dir> --locale <locale-code> [--format json|xliff12|xliff20|sitecore|optimizely|umbraco] [--expand-budget] [--notes]- Allowed tools
-
ReadWriteEditBash(find *)Bash(ls *)Bash(cat *)Bash(grep *)
- Source
plugins/copy-localization-generator/skills/localization-pack-generator/SKILL.md
Edit this skill on GitHub — opens GitHub's web editor. No git knowledge needed.