agentleFS
sorawit-wsorawit-w/agent-skills/skills/i18n/SKILL.md

i18n

Skill2 starsChanged 5 months agoMITView on GitHub

Handle internationalization (i18n) translation files and produce culturally authentic translations. Use when: (1) editing, creating, or modifying translation files (JSON, YAML, TypeScript, JS) — especially large ones that risk exceeding token limits; (2) translating UI strings into any supported language/dialect; (3) reviewing translations for cultural accuracy and naturalness; (4) syncing translation keys across multiple locale files; (5) adding new languages or regional variants to an existing i18n setup. Triggers on "translate", "i18n", "localization", "translation file", "locale", "add language", "translation keys", or any specific locale code (e.g., th, ja, ko, zh-CN, de, fr, es, it, zh-TW, zh-HK, th-bupphe). Does NOT trigger on defining or glossing a single word/phrase inside a sentence ("what does X mean here", "define X in context") — that is the `define` skill. This skill is for i18n files and shipping localized strings, not inline word-meaning lookups.

47 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use oss-pr, pr-automation and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • CES-LtdSkill

    oss-pr

    Use when creating a pull request, after committing changes, or when user invokes /oss-pr. Covers branch management, quality checks, commit, push, and PR creation.

    Also in 3 projects that use this

  • CES-LtdSkill

    pr-automation

    PR Automation Orchestrator: poll open PRs, check CI, run review, fix, and merge eligible PRs. Use when: (1) Invoked by daemon via scripts/pr-automation.sh, (2) User says "/pr-automation".

    Also in 3 projects that use this

  • volovelySkill

    pr-fix

    This skill should be used when the user asks to "fix PR comments", "address PR feedback", "resolve PR comments", provides a GitHub PR URL with intent to fix, or says "pr-fix". It reads all review comments on a PR, decides which need code fixes vs. replies, makes the fixes, and posts replies — all with explicit user approval before any GitHub action.

    Also in 3 projects that use this

  • GitHubSkill

    state-management

    CoreAI Sandbox's TanStack Query + mock-JSON data layer. USE WHEN: editing data-fetching hooks (`app/hooks/use*.ts`), adding mock data in `app/data/`, or wiring a component to query state.

    Also in 4 projects that use this

  • xfstudioSkill

    graphql

    GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.

    Also in 3 projects that use this

  • MicrosoftSkill

    bump-version

    Bump the VoxelPic version to a user-specified value. USE FOR: setting or updating the project version across all files that embed it. Applies to requests like 'bump version to X.Y.Z', 'set version', or 'update version'.

    Also in 4 projects that use this

  • +2 more from CES-Ltd

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 13 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 38 edited versions we read keep these.

  • 13

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always use surgical, minimal edits instead.

    line 36
  2. Distinctive:

    Do NOT output the full file content when editing an existing file.

    line 53
  3. Distinctive:

    Do NOT use a "replace entire file" operation to change a few keys.

    line 54
  4. Distinctive:

    If a tool only supports full-file writes (no partial edit), use the script approach (see below).

    line 55
  5. Distinctive:

    When adding, updating, or removing keys, target only the affected lines.

    line 67
  6. Distinctive:

    When changes are too numerous or complex for surgical edits (e.g., adding 50+ keys, restructuring namespaces, syncing across locales), …

    line 93
  7. Very specific:

    Use ts-morph or similar to add properties to the exported object without altering the rest of the file.

    line 131
  8. Distinctive:

    When writing back a TS translation file, preserve the original structure:

    line 158
  9. Very specific:

    Ensure the import statement for the type (e.g., Translations) is preserved.

    line 168
  10. Distinctive:

    If the task is "add these keys to all locale files":

    line 172
  11. Distinctive:

    Write a script that iterates over all locale files.

    line 175
  12. Distinctive:

    Do NOT manually edit each locale file one by one — this is error-prone and token-expensive.

    line 179
  13. Distinctive:

    After any translation file modification:

    line 184
  14. Distinctive:

    Verify the file is valid (parseable JSON, valid TS syntax, etc.).

    line 186
  15. Distinctive:

    Run any existing i18n linting or type-checking commands if available.

    line 187

“Common” is measured: kept by at least 6 in 10 of the 38 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

i18n — Translation Files & Cultural Rewriting

This skill has two parts:

  1. File Handling — How to safely edit translation files without hitting token limits.
  2. Translation Teams — How to produce culturally authentic translations using a multi-role review process.

Part 1: Handling Translation / i18n Files

Why This Matters

Translation files can be extremely large (thousands of keys). Attempting to rewrite an entire translation file will likely exceed output token limits and cause errors. Always use surgical, minimal edits instead.

File Formats

Translation files may exist in any of these formats:

FormatExampleNotes
JSONen.json, messages.jsonMost common. Flat or nested key-value.
YAMLen.yml, messages.yamlCommon in Rails, Spring, etc.
TypeScripten.ts, translations.tsUsed when types are shared across projects. Often exports an object as const or uses satisfies.
JS/MJSen.js, en.mjsLegacy or framework-specific.

Rules

1. NEVER rewrite an existing translation file in full

  • Do NOT output the full file content when editing an existing file.
  • Do NOT use a "replace entire file" operation to change a few keys.
  • If a tool only supports full-file writes (no partial edit), use the script approach (see below).

Exceptions — full-file writes are fine when:

  • Creating a new locale file from scratch (e.g., adding it.json for the first time).
  • Generating an initial translation of an entire file into a new language.
  • The file is small enough (< 200 keys) that a full rewrite won't risk token limits.

The rule exists to prevent token-limit blowups on large existing files, not to block legitimate file creation.

2. Prefer surgical edits

When adding, updating, or removing keys, target only the affected lines.

Example — adding keys to a JSON file:

   "dashboard.title": "Dashboard",
+  "dashboard.subtitle": "Welcome back",
+  "dashboard.empty_state": "No data available",
   "dashboard.footer": "© 2025"

Example — adding keys to a TypeScript file:

 export const en = {
   dashboard: {
     title: 'Dashboard',
+    subtitle: 'Welcome back',
+    emptyState: 'No data available',
     footer: '© 2025',
   },
 } as const;

3. Use a script for bulk operations

When changes are too numerous or complex for surgical edits (e.g., adding 50+ keys, restructuring namespaces, syncing across locales), write a one-off script that reads, transforms, and writes the file programmatically.

For JSON files:

import fs from 'fs';

const filePath = './locales/en.json';
const translations = JSON.parse(fs.readFileSync(filePath, 'utf-8'));

const newKeys = {
  'feature.title': 'New Feature',
  'feature.description': 'This is a new feature',
};

Object.assign(translations, newKeys);
fs.writeFileSync(filePath, JSON.stringify(translations, null, 2) + '\n');

For TypeScript files:

TS translation files cannot be naively JSON-parsed. Use one of these strategies:

  • Strategy A — Dynamic import (preferred when structure is export default or named export):

    const mod = await import('./locales/en.ts');
    const translations = mod.default ?? mod.en;
    // Merge new keys, then serialize back

    ⚠️ This loses as const / satisfies type annotations. You must re-apply them when writing back. See serialization note below.

  • Strategy B — AST manipulation (when type safety must be preserved exactly):

    Use ts-morph or similar to add properties to the exported object without altering the rest of the file.

    import { Project, SyntaxKind } from 'ts-morph';
    
    const project = new Project();
    const sourceFile = project.addSourceFileAtPath('./locales/en.ts');
    const obj = sourceFile
      .getVariableDeclarationOrThrow('en')
      .getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
    
    obj.addPropertyAssignment({
      name: "'newKey'",
      initializer: "'New Value'",
    });
    
    await sourceFile.save();
  • Strategy C — Regex/text insertion (simple cases only):

    Find the closing } of the target object and insert before it. Fragile but acceptable for appending a few keys to a well-known structure.

Serialization note for TS files:

When writing back a TS translation file, preserve the original structure:

// If the original uses `as const`:
const output = `export const en = ${JSON.stringify(merged, null, 2)} as const;\n`;

// If the original uses `satisfies`:
const output = `export const en = ${JSON.stringify(merged, null, 2)} satisfies Translations;\n`;

Ensure the import statement for the type (e.g., Translations) is preserved.

4. When syncing across locales

If the task is "add these keys to all locale files":

  1. Define the new keys in a single object/variable.
  2. Write a script that iterates over all locale files.
  3. For each file, read → merge (without overwriting existing keys) → write.
  4. Log which files were updated and which keys were added.

Do NOT manually edit each locale file one by one — this is error-prone and token-expensive.

5. Validate after changes

After any translation file modification:

  • Verify the file is valid (parseable JSON, valid TS syntax, etc.).
  • Run any existing i18n linting or type-checking commands if available.
  • Confirm no existing keys were accidentally removed or overwritten.

Part 2: Translation Teams — Role-Based Contextual Rewriting

Philosophy

Translation is not word-for-word substitution. It is contextual rewriting inside cultural reality. Every string a user reads should feel like it was originally written in their language — by someone who lives in their market, uses their apps, and thinks in their idioms.

To achieve this, adopt a multi-role review process before finalizing any translation. Each role contributes a different lens. Internally simulate all applicable roles and reconcile their perspectives before producing final output.

Workflow

  1. Identify the target locale — language alone isn't enough. Thai (standard) ≠ Thai (Gen Z) ≠ Thai Isan. Each has its own team.
  2. Draft an initial translation considering UI context, intent, and tone.
  3. Pass the draft through each role's lens for the target locale.
  4. Handle pluralization — apply the target language's pluralization rules (see Pluralization section below).
  5. Reconcile conflicting feedback (e.g., copywriter wants flair, UX reviewer wants brevity) with a bias toward clarity and cultural fit.
  6. Output the final translation. Add a brief note if a key required non-obvious cultural adaptation.

Shared Roles (All Languages)

These roles apply to every target locale:

  • @ux localization reviewer — Ensures translations work within UI constraints (character length, button labels, truncation). Validates that tone matches the interaction context (error message vs. celebration vs. onboarding).
  • @i18n engineer — Handles interpolation variables ({count}, {name}), pluralization rules, gender agreement, and format consistency (dates, numbers, currency). Ensures the translated string won't break at runtime.

Per-locale teams, pluralization & cultural notes

The per-locale translation teams, pluralization rules, counter-word rules, and all cultural notes live in a shared reference: references/locale-knowledge.md.

This is the shared cultural engine for two skills — i18n (this one: translation-file production) and define (inline contextual definition/translation). When working a specific locale, load it: it carries the per-locale role tables, register systems, dialect vocabulary, classical forms (e.g. th-bupphe), honorifics, classifiers, the pluralization category table, and the zh-CN → zh-TW "not a character swap" rule.

Edit locale facts there once; both skills inherit. This skill layers its file-handling discipline (Part 1) and its @ux localization reviewer / @i18n engineer roles on top; define layers its own comprehension lenses (lexicographer, etymology, register) for learner-facing glosses.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.