Skip to content

Commit 7dd47c1

Browse files
committed
chore: add i18n-static agent skill to dev-demo AdminForth/1609/add-few-languages-support-out-
1 parent 8ecf413 commit 7dd47c1

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

  • dev-demo/.agents/skills/adminforth-i18n-static
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: adminforth-i18n-static
3+
description: "Use when asked to translate AdminForth admin panel UI, fill missing translations, or add a new admin language with @adminforth/i18n-static plugin (JSON files per language)."
4+
user-invocable: true
5+
---
6+
7+
# AdminForth Static Translations Workflow
8+
9+
## How Translations Work
10+
11+
- Every supported language has its own flat JSON file `<translationsDir>/<language code>.json` (`langs/` by default), e.g. `langs/uk.json`, `langs/pt-BR.json`.
12+
- Keys are original English strings from admin UI, values are translations: `{ "Save": "Зберегти" }`.
13+
- Empty value means "not translated yet", admin shows the original English key instead.
14+
- Files are read on every request, so edits are visible after page reload without restart.
15+
16+
## Workflow
17+
18+
1. Sync keys first, so every language file contains all actual keys:
19+
`pnpm exec adminforth-i18n-static sync` (or `npx adminforth-i18n-static sync` for npm).
20+
It prints every language file with counts: `total`, `added`, `stale` and `untranslated`.
21+
2. Fill empty values in language files the user asked for (all non-English files if not specified).
22+
3. Run sync again and make sure `untranslated` is 0 for translated files and there is no `wrong plural` warning. Fix every listed plural string.
23+
24+
## Translation Rules
25+
26+
- Never change, add or remove keys, only write values. Keep keys order.
27+
- Do not translate `en.json`: sync fills its values with the keys (original English strings). Change its values only if the user asks to rephrase English texts.
28+
- Do not touch non-empty values unless the user asks to fix them.
29+
- Do not remove stale keys (reported as `stale`), the user decides about them.
30+
- Keep variables in curly brackets exactly as in the key and do not translate them: `"Hello {name}"` → `"Привіт {name}"`, never `{ім'я}`.
31+
- Keys with `|` are plural forms. Keep the same number of forms separated by `|`, except Slavic languages
32+
(uk, ru, be, pl, cs, sk, bg, sr, hr, mk, sl) which need 4 forms "zero | singular | 2-4 | 5+",
33+
e.g. `"apple | apples"` in `uk.json` becomes `"яблук | яблуко | яблука | яблук"`.
34+
- For codes with region (e.g. `pt-BR`) use regional spelling, punctuation and formatting.
35+
- Keep translations short: they are UI labels, buttons and messages of an admin panel.
36+
- If meaning of a key is not clear (short words like `Show`, `of`, `to`, `Your` or sentence fragments), find where it is used:
37+
search for the key in `$t('...')` / `t('...')` calls in project custom components and in AdminForth sources
38+
(`node_modules/adminforth/dist/spa/src`, `node_modules/@adminforth/*/dist/custom`). Translate by context: a button, a label
39+
or a part of a sentence glued with other text in the template, then the translation must fit the whole phrase.
40+
- Keep JSON valid with 2 spaces indentation.

0 commit comments

Comments
 (0)