From 2c37dba1437e30b6bc7ad0cfb0b5e5b80d0fea78 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 30 May 2025 02:22:40 -0700 Subject: [PATCH] [docs] Add Claude command for adding missing i18n strings (#4023) --- .claude/commands/add-missing-i18n.md | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .claude/commands/add-missing-i18n.md diff --git a/.claude/commands/add-missing-i18n.md b/.claude/commands/add-missing-i18n.md new file mode 100644 index 000000000..4b8414189 --- /dev/null +++ b/.claude/commands/add-missing-i18n.md @@ -0,0 +1,43 @@ +# Add Missing i18n Translations + +## Task: Add English translations for all new localized strings + +### Step 1: Identify new translation keys +Find all translation keys that were added in the current branch's changes. These keys appear as arguments to translation functions: `t()`, `st()`, `$t()`, or similar i18n functions. + +### Step 2: Add translations to English locale file +For each new translation key found, add the corresponding English text to the file `src/locales/en/main.json`. + +### Key-to-JSON mapping rules: +- Translation keys use dot notation to represent nested JSON structure +- Convert dot notation to nested JSON objects when adding to the locale file +- Example: The key `g.user.name` maps to: + ```json + { + "g": { + "user": { + "name": "User Name" + } + } + } + ``` + +### Important notes: +1. **Only modify the English locale file** (`src/locales/en/main.json`) +2. **Do not modify other locale files** - translations for other languages are automatically generated by the `i18n.yaml` workflow +3. **Exception for manual translations**: Only add translations to non-English locale files if: + - You have specific domain knowledge that would produce a more accurate translation than the automated system + - The automated translation would likely be incorrect due to technical terminology or context-specific meaning + +### Example workflow: +1. If you added `t('settings.advanced.enable')` in a Vue component +2. Add to `src/locales/en/main.json`: + ```json + { + "settings": { + "advanced": { + "enable": "Enable advanced settings" + } + } + } + ```