localize
Replaces hardcoded text with translation hooks and syncs keys across JSON locale files for consistent internationalization.
Install
mkdir -p .claude/skills/localize && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/7452" && unzip -o skill.zip -d .claude/skills/localize && rm skill.zipInstalls to .claude/skills/localize
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Localize ryOS apps and components by extracting hardcoded strings, replacing with translation keys, and syncing across languages. Use when localizing an app, adding i18n support, translating UI text, or working with translation files.Key capabilities
- →Extract hardcoded UI strings from components
- →Replace strings with translation hooks
- →Sync translation keys across JSON locale files
- →Perform machine translation of missing keys
- →Audit translation coverage and terminology
- →Validate help item alignment
How it works
The skill uses automated scripts to extract strings, inject translation hooks, and sync keys across multiple language files, while enforcing terminology rules via an audit process.
Inputs & outputs
When to use localize
- →Extract hardcoded UI strings
- →Implement i18n support
- →Sync translation json files
About this skill
Localize App or Component
Workflow Checklist
- [ ] 1. Extract hardcoded strings
- [ ] 2. Replace with t() calls in source files
- [ ] 3. Add English translations to en/translation.json
- [ ] 4. Sync translations across languages
- [ ] 5. Machine translate [TODO] keys
- [ ] 6. Validate coverage and terminology
Step 1: Extract Hardcoded Strings
bun run i18n:extract --pattern [PATTERN]
Step 2: Replace Strings with t() Calls
For each component:
- Add import:
import { useTranslation } from "react-i18next"; - Add hook:
const { t } = useTranslation(); - Replace strings:
t("apps.[appName].category.key") - Add
tto dependency arrays foruseMemo/useCallback
Key Structure
apps.[appName].menu.* # Menu labels
apps.[appName].dialogs.* # Dialog titles/descriptions
apps.[appName].status.* # Status messages
apps.[appName].toasts.* # Toast titles/descriptions
apps.[appName].empty.* # Empty-state titles/hints
apps.[appName].ariaLabels.* # Accessibility labels
apps.[appName].help.* # Help items (auto-translated)
apps.[appName].speech.* # Spoken feedback / speech labels
apps.[appName].conversion.* # Unit conversion labels
apps.[appName].angle.* # Angle-mode labels
common.auth.* # Shared login/signup/recovery dialog labels
Common Patterns
// Basic
t("apps.ipod.menu.file")
// With variables
t("apps.ipod.status.trackCount", { count: 5 })
// Conditional
isPlaying ? t("pause") : t("play")
// With symbol prefix
`✓ ${t("apps.ipod.menu.shuffle")}`
Step 3: Add English Translations
Add to src/lib/locales/en/translation.json:
{
"apps": {
"ipod": {
"menu": { "file": "File", "addSong": "Add Song..." },
"dialogs": { "clearLibraryTitle": "Clear Library" },
"status": { "shuffleOn": "Shuffle ON" }
}
}
}
Do not rely on defaultValue as the only copy of a new key. t("some.key", { defaultValue: "English" }) renders, but sync and audit scripts only compare locale JSON files, so missing keys stay invisible until the English catalog contains them.
Use Apple-style title casing for standalone English menu and control labels, such as Repeat All, Repeat One, Sign In, and Main Volume. When a casing or terminology rule should be enforced globally, add the key to ENGLISH_STYLE_EXPECTATIONS in scripts/apple-ui-terminology.ts and cover it with tests/unit/i18n/test-translation-audit.test.ts.
Step 4: Sync Across Languages
bun run i18n:sync:mark-todo
Adds missing keys to all 11 language files, marked with [TODO].
Step 5: Machine Translate
bun run i18n:translate
Requires GOOGLE_GENERATIVE_AI_API_KEY env variable.
Step 6: Validate
bun run i18n:sync:dry-run
bun run i18n:audit
bun run i18n:find-untranslated
Use bun run i18n:audit:fix only for terminology drift the script can safely repair, then rerun bun run i18n:audit. When audit reports glossary mismatches that are not auto-fixable, edit the affected locale JSON values by hand and rerun the audit.
Component Guidelines
| Component | What to translate |
|---|---|
| Menu bars | All labels, items, submenus |
| Dialogs | Titles, descriptions, button labels |
| Status | showStatus() calls and inline state labels |
| Toasts / empty states | Sonner toast copy, empty-state titles, empty-state hints |
| Help items | Auto-translated via useTranslatedHelpItems |
| Shared auth dialogs | common.auth.*, for login/signup/password recovery copy |
Notes
- Emoji/symbols (♪, ✓) can stay hardcoded
- Help items use pattern:
apps.[appName].help.[key].title/description - Help item key order lives in
src/hooks/useTranslatedHelpItems.ts; apps with longer localized help rows can export their key list (for examplesrc/apps/maps/helpKeys.ts,src/apps/calculator/helpKeys.ts, orsrc/apps/internet-explorer/helpKeys.ts) and spread it intoAPP_HELP_I18N_KEYS tests/unit/i18n/test-help-i18n-alignment.test.tscovers every registered app; update it only if the global help-key contract changes- Include
tin dependency arrays when used inuseMemo/useCallback - If Apple terminology changes upstream, refresh the glossary source with
bun run i18n:apple-glossarybefore auditing locale copy
When not to use it
- →Non-UI string localization
- →Projects not using the ryOS i18n structure
Prerequisites
Limitations
- →Requires adherence to specific ryOS component guidelines
- →Machine translation requires an API key
- →Terminology drift requires manual audit intervention
How it compares
It automates the entire localization lifecycle including extraction, syncing, and auditing, rather than manual key management.
Compared to similar skills
localize side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| localize (this skill) | 1 | 6mo | Review | Intermediate |
| react-modernization | 21 | 2mo | No flags | Advanced |
| typescript | 28 | 2mo | No flags | Beginner |
| i18n-localization | 15 | 6mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by ryokun6
View all by ryokun6 →You might also like
react-modernization
wshobson
Upgrade React applications to latest versions, migrate from class components to hooks, and adopt concurrent features. Use when modernizing React codebases, migrating to React Hooks, or upgrading to latest React versions.
typescript
lobehub
TypeScript code style and optimization guidelines. Use when writing TypeScript code (.ts, .tsx, .mts files), reviewing code quality, or implementing type-safe patterns. Triggers on TypeScript development, type safety questions, or code style discussions.
i18n-localization
davila7
Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.
react-patterns
davila7
Modern React patterns and principles. Hooks, composition, performance, TypeScript best practices.
i18n
lobehub
Internationalization guide using react-i18next. Use when adding translations, creating i18n keys, or working with localized text in React components (.tsx files). Triggers on translation tasks, locale management, or i18n implementation.
typescript-skills
llama-farm
Shared TypeScript best practices for Designer and Electron subsystems.