CyberStrikeAI frontend i18n is static and lightweight. Text is organized in JSON files and applied through data-i18n attributes plus JavaScript helper functions.
web/static/i18n/zh-CN.json
web/static/i18n/en-US.json
web/static/js/i18n.js
- Keep keys stable and semantic.
- Update Chinese and English together.
- Do not hardcode new visible text in JS when it should be localized.
- Preserve default HTML text as fallback before JS initialization.
<button data-i18n="common.save">保存</button>For attributes, follow the existing i18n.js conventions.
Use the global translation helper where available:
const label = t('common.save');When adding dynamic UI, make sure language switching refreshes the text or re-renders the component.
- Add or update UI text.
- Add keys to
zh-CN.json. - Add matching keys to
en-US.json. - Replace hardcoded text with
data-i18nort(). - Test both languages and browser console.
- Missing keys only in one language.
- Dynamic text built from hardcoded fragments.
- Button labels too long in English.
- HTML fallback text diverges from JSON text.
- Adding new page text without updating language switch behavior.