compile-i18n
How to add i18n to all the ts files, and use the compile_i18n.cmd command to compile the ts files
소스 정보
- 저장소
- vb2250158/ok-NIKKE
- 최근 소스 활동
- 2026년 5월 20일 16:47
- 감지된 SKILL.md 언어
- 영어
- 스타
- 1
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
파일 탐색기
2 개 파일SKILL.md 표시 중
SKILL.md
소스 지침 · 읽기 전용 미리보기- name
- Compile i18n
- description
- How to add i18n to all the ts files, and use the compile_i18n.cmd command to compile the ts files
# Compile i18n
When you are instructed to add or update internationalization (i18n) translations for this project, please follow these steps:
1. Identify the new strings that need to be translated.
2. Edit the `.ts` translation files located in the `ok/gui/i18n/` directory. Typically, these files include:
- `zh_CN.ts` (Simplified Chinese)
- `zh_TW.ts` (Traditional Chinese)
- `ja_JP.ts` (Japanese)
- `ko_KR.ts` (Korean)
- `es_ES.ts` (Spanish)
- `en_US.ts` (English)
3. Ensure that your new translations are correctly added under the appropriate `<context>` and `<message>` blocks in each XML file, without the `type="unfinished"` attribute. If you are adding many translations, or just want to minimize errors, use the provided `add_translation.py` script to automate the XML injection:
```powershell
$py = if (Test-Path .\.venv\Scripts\python.exe) { ".\.venv\Scripts\python.exe" } else { "python" }
& $py .\.agents\skills\compile_i18n\add_translation.py --context "YourContext" --source "Your Source String" --zh_cn "Your Chinese String"
```
**IMPORTANT WARNING: DO NOT use `pyside6-lupdate` as it corrupts and deletes existing translations. Always modify the XML nodes natively or use the python script!**
4. Check that there are no unfinished translations in the files. The `compile_i18n.cmd` script will automatically abort if it detects `type="unfinished"` in any translation text. You must replace `<translation type="unfinished" />` with `<translation>Your Translation</translation>`.
5. After updating the `.ts` files, compile them into `.qm` binary format by leveraging the provided script. Run the following command from the workspace root:
// turbo
```powershell
.\compile_i18n.cmd
```
This will run `pyside6-lrelease` on all language files and generate the corresponding `.qm` files used by the application, as well as compile updated resources if necessary.
GitHub에서 보기