Polyglot
Skill DevManuelSereno/polyglot
One skill for the entire i18n journey — internationalize your app from scratch. Creates i18n from scratch, migrates hardcoded strings, or refactors keys/namespaces safely with impact analysis.
npx -y skills add DevManuelSereno/polyglotAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
One skill for the entire i18n journey. Creates i18n from scratch, migrates hardcoded strings to translation calls, refactors existing i18n keys with impact analysis, AND translates content to multiple locales. Use when creating i18n, migrating strings, renaming keys/namespaces, or translating locale files across next-intl, react-i18next, vue-i18n, react-intl, i18next, angular, svelte, or lingui. Does NOT change component architecture or refactor non-i18n code.
SKILL.md
9.5 KB, as published. Nobody here has run it
Polyglot
One skill for the entire i18n journey. Four modes:
- Create — create i18n from scratch when your project has none
- Migrate — surgically migrate hardcoded strings when i18n exists
- Refactor — rename keys/namespaces safely with impact analysis
- Translate — generate translations for all locales from a source file
Project Context
node ${CLAUDE_SKILL_DIR}/scripts/detect-conventions.js --quick
Arguments
- $mode:
create,migrate,refactor, ortranslate. Auto-detected if omitted. - $target: File(s) to process (migrate/refactor mode)
Routing
- Run discovery → discovery.md
- No i18n → Create
- i18n exists + user wants migrate → Migrate
- i18n exists + user wants rename/refactor → Refactor
- i18n exists + user wants translations → Translate
- User passed explicit mode → follow it
Scope Rules
Create
- Create i18n architecture (providers, config, translation files)
- Follow framework conventions
- Minimal scaffolding — no over-engineering
Migrate
- Do not modify files outside scope
- Do not create new architecture
- Do not refactor or modernize
- Do not alter business logic
- Do not touch unrelated lines
Refactor
- Impact analysis is mandatory before any change
- Explicit confirmation required at each phase (analyze → preview → apply → validate)
- Only rename keys/namespaces — do not change component logic
- Report all cross-module dependencies
Translate
- Always preserve
{interpolation}variables from source - Mark machine translations as draft unless user confirms otherwise
- Use
--validateto check consistency after translation - Prefer free backends (Google) unless user requests higher quality
Workflow
Phase 1: Discover
Step 1: Check for conventions file
- Look for
.claude/polyglot-conventions.mdin project root - If exists AND contains
skip-discovery: true:- Load all conventions from file
- Skip Steps 2-5 entirely
- Go directly to Phase 2 (Route)
- If not exists OR
skip-discovery: false:- Proceed to Step 2
Step 2: Fast Scan (only if no skip)
- Run
node ${CLAUDE_SKILL_DIR}/scripts/detect-conventions.js --quick - Output: library, storage, locales (~200 tokens)
Step 3: Convention Detection (only if no skip)
- Run
node ${CLAUDE_SKILL_DIR}/scripts/detect-conventions.js(deep mode) - Analyze 10 files for patterns (~2k tokens)
Step 4: Load User Overrides (only if no skip)
- Read
.claude/polyglot-conventions.mdif exists - Merge with detected conventions (user overrides take priority)
Step 5: Present to User (only if no skip)
- Show detected conventions
- Ask: "Do these conventions match your project? [Y/n/edit]"
- If user confirms: proceed to Phase 2
- If user edits: update conventions, proceed to Phase 2
- Offer to save
.claude/polyglot-conventions.mdfor future sessions
Low confidence → invoke /i18n-analyzer.
Phase 2: Route
- No i18n? → Create
- Migrate strings? → Migrate
- Rename keys/namespaces? → Refactor
- Generate translations? → Translate
Phase 3A: Create
Follow create.md:
- Recommend library based on framework
- Install dependencies
- Create config + translation files
- Add provider to app root
- Create example component
Phase 3B: Migrate
Read reference + target + translation files. Extract: hook pattern, key convention, reusable keys.
Phase 3C: Refactor
Follow refactor.md:
- Impact Analysis — find all usages, cross-module dependencies, blast radius
- Preview — show exact diff, list all files to change
- Apply — rename in all components + translation files
- Validate — check for orphaned references, run validation
Phase 3D: Translate
- Detect source locale and translation file structure
- Ask user for target locales (if not specified)
- Ask user for backend preference (google/deepl/chatgpt)
- Run
python ${CLAUDE_SKILL_DIR}/scripts/translate.py --source <locale> --targets <locales> --dir <dir> --validate - Review output, fix any issues
Phase 4: Identify (Migrate only)
Find: labels, placeholders, errors, aria-labels, tooltips, buttons. Exclude: constants, logs, identifiers, CSS, data attributes.
Phase 5: Apply Patterns (Migrate only)
Follow patterns.md: interpolation, pluralization, formatting, rich text. Smallest change only: replace strings, add hook/import if absent.
Phase 6: Update Translations (All modes except Create)
- Local: Run
python ${CLAUDE_SKILL_DIR}/scripts/translate.py --source <locale> --targets <locales> --dir <dir> --validate- Supports backends:
google(free, default),deepl(API key),chatgpt(API key) - Preserves
{variables}in translations automatically - Use
--draftto mark output for review - Use
--dry-runto preview without writing files
- Supports backends:
- Remote: Output keys for user to upload to TMS
Phase 7: Validate
Auto-runs via Stop hook. Fix errors → re-validate.
Phase 8: Respond
Mode: [create|migrate|refactor|translate]
Files changed:
- path/to/file.tsx
Changes:
- [create] created i18n config with [library]
- [migrate] migrated N strings
- [refactor] renamed X keys across Y files
- [translate] translated N keys to M locales using [backend]
Validation: ✓ passed / ✗ failed (see errors above)
Notes:
- <decisions only>
Key Strategy (Migrate)
- Check reference for equivalent keys
- Check target (may be partially migrated)
- Reuse when semantically equivalent
Good: profile.header.title, profile:header.title
Bad: title, headerText, page.content.section.label.text
Large Files (20+ strings, Migrate mode only)
Batch by section. Ask scope. One batch at a time.
Error Handling
| Scenario | Action |
|---|---|
| Detection fails | Auto-invoke /i18n-analyzer |
| Pattern unclear | Ask before proceeding |
| Validation fails | Fix, re-validate |
| Refactor impact too high | Abort, suggest manual approach |
| Create: user disagrees with library choice | Respect user's choice |
| Refactor: 0 usages found | Abort — target doesn't exist |
| Translate: Python not installed | Guide user to install Python + pip install deep-translator |
| Translate: API key missing | Ask user for API key or suggest free backend |
| Translate: variables lost | Auto-restore {variables} from source |
Translation Tool
Polyglot includes a Python translation tool (scripts/translate.py) that generates translations for all locales from a source file.
See scripts/translate.py for full documentation, or run:
uv run ${CLAUDE_SKILL_DIR}/scripts/translate.py --help
Quick Start
# Install uv if you don't have it (recommended)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Run with uv (auto-installs Python + dependencies)
uv run ${CLAUDE_SKILL_DIR}/scripts/translate.py --source pt --targets en,es
# Or with pip
pip install -r ${CLAUDE_SKILL_DIR}/scripts/requirements.txt
python ${CLAUDE_SKILL_DIR}/scripts/translate.py --source pt --targets en,es
Backends
| Backend | Quality | Cost | API Key |
|---|---|---|---|
google | Good | Free | Not required |
deepl | Excellent | Free tier (500k chars/mo) | DEEPL_API_KEY |
chatgpt | Best (context-aware) | Paid | OPENAI_API_KEY |
Features
- Preserves
{interpolation}variables across translations - Batch translation for performance
- Draft marking for review workflows (
--draft) - Auto-validates with
validate-keys.js(--validate) - Nested JSON structure preservation
- Dry-run mode (
--dry-run)
Resources
- discovery.md — Detection + routing
- conventions.md — Auto-detection + manual override
- create.md — Scaffolding per library
- refactor.md — Safe refactoring with impact analysis
- patterns.md — Interpolation, pluralization, Good/Bad
- examples.md — Before/after for every library
- agents/i18n-analyzer.md — Deep analysis subagent
- scripts/translate.py — Translation tool (multi-backend)
- scripts/validate-keys.js — Key validation
- scripts/detect-conventions.js — Convention detection