Enforce Rules For I18n enforce-rules-for-i18n
Review pending AIRI translations on Crowdin in a batch, then sync them into the repository.
Use it when crowdin has translations that wait for approval, when translations have not reached the repository for days, or when the user pastes output of pending-review.mjs.
- Our test
- 8/10✓ Verified
- tested Dec 6, 2026
- GitHub stars
- 52k
- moeru-ai/airi
- Added by
- 0
- members
- Updated
- Dec 6
- commit f28d10e
- Content
- 4 files
- 2 scripts · 16 KB
- License
- MIT
- free to use
What our test found
The skill gives a concrete, cautious review workflow with clear decision criteria and protects the user's token, though actual review requires repository and pending-review data.
Limits spotted
- The prompt alone cannot produce meaningful translation decisions without the pending-review JSON and locale references.
- The whitespace check in the script appears to detect trailing newlines but not leading whitespace despite its diagnostic wording.
- The apply script performs approvals before deletions, so an API failure partway through can leave a partially applied batch.
name: enforce-rules-for-i18n description: Review pending AIRI translations on Crowdin in a batch, then sync them into the repository. Use when Crowdin has translations that wait for approval, when translations have not reached the repository for days, or when the user pastes output of pending-review.mjs.
Crowdin batch review for AIRI
This skill reviews the translations that wait for approval on the AIRI Crowdin project. An agent judges each translation. A person applies the result with their own token.
Requirements
- Node.js 24 or later, and
pnpm installin this repository. The check script imports the placeholder rule from.github/scripts/check-locales.ts. - A Crowdin personal access token with proofreader or manager access to the AIRI project. Create it in Crowdin: Account Settings > API > Personal Access Tokens.
- The project id defaults to
816610, the id incrowdin.ymlofmoeru-ai/airi. To use another project, setCROWDIN_PROJECT_ID.
Token rules
- The person sets the token in their own terminal. The agent never asks for, reads, prints, or passes the token.
- Set the token for the current terminal only. Do not write it into a shell profile.
read -rs "CROWDIN_PERSONAL_TOKEN?Crowdin token: " && export CROWDIN_PERSONAL_TOKENThe command above is for zsh. In bash, use read -rsp "Crowdin token: " CROWDIN_PERSONAL_TOKEN && export CROWDIN_PERSONAL_TOKEN.
Workflow
The scripts read and write their files in the current directory. Run them from a work directory outside the repository, so the review files stay out of Git. <repo> is the root of this repository.
- Check (person runs). This step is read-only.
node <repo>/.agents/skills/enforce-rules-for-i18n/scripts/pending-review.mjsIt prints a table for each language. It writes crowdin-pending-review.json with all pending translations. It writes crowdin-pending-review.md with the flagged ones only: placeholder mismatch, same as English, and bad whitespace.
If the table shows 0 pending, there is nothing to review. Go to step 5.
- Review (agent). Read
crowdin-pending-review.jsonand judge every entry with the policy below. Writecrowdin-review-decisions.json:
{
"approve": [{ "languageId": "es-ES", "file": "stage.yaml", "key": "a.b", "text": "..." }],
"reject": [{ "languageId": "es-ES", "file": "stage.yaml", "key": "a.b", "text": "...", "reason": "..." }]
}Generate this file from the JSON with a script. Do not type file, key, or text by hand. The apply script matches the exact text.
- Dry run (person runs).
node <repo>/.agents/skills/enforce-rules-for-i18n/scripts/apply-review.mjsThe output must end with All matched. If one entry does not match, the script stops and changes nothing.
- Apply (person runs).
node <repo>/.agents/skills/enforce-rules-for-i18n/scripts/apply-review.mjs --approve --delete-rejectedBefore it deletes, the script writes a backup to crowdin-rejected-backup-<timestamp>.json.
Then run step 1 again. A deleted translation can uncover an older suggestion for the same string. Review the new entries until pending is 0.
- Sync. The
crowdin-cron-sync.ymlworkflow exports approved translations once a day. To sync now, run it manually from GitHub Actions. It updates thechore(i18n): update translationspull request.
Review policy
Reject a translation when:
- It is the same as the English text, even when the word is correct in that language, for example
OK,Error, or a brand name. AIRI shows the English text for a string without a translation. Crowdin does not import a translation that is the same as the source. - It has the wrong meaning or the wrong part of speech, for example a noun label translated as a verb phrase.
- Its placeholders differ from the English text:
{name},{0}, or@:key. - It contains a literal
\nwhere the English text has a line break.
Approve a translation when its meaning is correct, even if it has small style problems. List those problems in the report, so a translator can fix them on Crowdin. Do not reject a translation only for style.
Compare terms with the existing translations in packages/i18n/src/locales/<locale>/. Some Crowdin language ids differ from the folder names:
| Crowdin | Folder | | --- | --- | | es-ES | es | | zh-CN | zh-Hans | | zh-TW | zh-Hant |
Language notes:
- Spanish uses "tú", not "usted". Spanish titles use sentence case.
The report to the person has three parts: the counts, a table of rejected translations with the reasons, and a short list of approved translations that have style problems.
Warnings in the sync pull request
- "Same translation as <other key>, whose English has no word in common" is a heuristic. It checks only strings that changed against
main. After the pull request merges, the warning does not come back. Do not add an allowlist. - Synonyms cause false positives, for example "Settings" and "Configuration". If the older key on
mainhas the wrong translation, fix that key on Crowdin. - New quotes around a translation come from Crowdin. When the English source string has quotes, for example
error: 'Error:', Crowdin adds quotes to the translation too. The value does not change.
Fixing one approved translation
The batch scripts handle pending translations only. When an approved translation is wrong, write a small script for that string:
- Find the string by its file and key.
- Without
--apply, print all translations of the string in that language and their approval state. - With
--apply, write a backup, add and approve the correct text, and delete the other translations of the string in that language.