← Back to PRs

#21988: feat(i18n): added Thai (th) locale

by samithiwat open 2026-02-20 16:11 View on GitHub →
app: web-ui size: S
## Summary Describe the problem and fix in 2–5 bullets: - Problem: - Why it matters: - What changed: - What did NOT change (scope boundary): ## Change Type (select all) - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Docs - [ ] Security hardening - [ ] Chore/infra ## Scope (select all touched areas) - [ ] Gateway / orchestration - [ ] Skills / tool execution - [ ] Auth / tokens - [ ] Memory / storage - [ ] Integrations - [ ] API / contracts - [x] UI / DX - [ ] CI/CD / infra ## Linked Issue/PR - Related https://github.com/openclaw/openclaw/issues/3460 ## User-visible / Behavior Changes List user-visible changes (including defaults/config). If none, write `None`. ## Security Impact (required) - New permissions/capabilities? (`No`) - Secrets/tokens handling changed? (`No`) - New/changed network calls? (`No`) - Command/tool execution surface changed? (`No`) - Data access scope changed? (`No`) ## Repro + Verification ### Environment - OS: Any (browser-based Control UI) - Runtime/container: N/A - Model/provider: N/A - Integration/channel (if any): N/A - Relevant config (redacted): N/A ### Steps 1. Navigate to the Overview tab within the Control UI. 2. From the language dropdown menu, select ภาษาไทย. 3. Confirm that all UI elements and labels successfully transition to Thai. 4. Refresh the browser and verify that the Thai language setting persists via localStorage. ### Expected - All localized strings correctly default to Thai. - User language settings are maintained across browser sessions ### Actual - All localized strings correctly default to Thai. - User language settings are maintained across browser sessions ## Evidence Attach at least one: - [x] Failing test/log before + passing after - [ ] Trace/log snippets - [x] Screenshot/recording - [ ] Perf numbers (if relevant) ## Human Verification (required) What you personally verified (not just CI), and how: <img width="3414" height="1307" alt="image" src="https://github.com/user-attachments/assets/ed1bf6b0-641a-46b0-8a00-a742a07e4f0c" /> - Verified Scenarios: Confirmed successful build completion and validated that all locale files maintain a consistent th key structure, strictly mirroring en.ts. - Edge Case Handling: Leveraged TypeScript’s TranslationMap to enforce key parity. By design, any missing keys in th.ts trigger a build-time error, ensuring 100% translation coverage. ## Compatibility / Migration - Backward compatible? (`Yes`) - Config/env changes? (`No`) - Migration needed? (`No`) ## Failure Recovery (if this breaks) Rollback Procedure: Delete th.ts, excise all th entries from existing locale files, and prune the th logic from the setLocale function. Files to Revert: - `ui/src/i18n/locales/th.ts` (Delete) - `ui/src/i18n/locales/{en, zh-CN, zh-TW, pt-BR}.ts` (Remove keys) - `ui/src/i18n/lib/translate.ts` (Revert logic) ## Risks and Mitigations List only real risks for this PR. Add/remove entries as needed. If none, write `None`. - Risk: Potential nuances in technical UI terminology may lack 100% accuracy. - Mitigation: Content was authored by a native speaker with technical terms preserved in English for clarity. Additionally, the community is encouraged to submit refinements via follow-up PRs. <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR adds Thai language support to the i18n system, including a complete translation file (`th.ts`) with all required keys mirroring the English locale. However, there's a critical bug in `translate.ts:63` that breaks all existing locales with hyphens in their names (`pt-BR`, `zh-CN`, `zh-TW`). **Major Issues:** - Critical logic error in `translate.ts` that will break Portuguese and Chinese translations by attempting to access module exports with hyphens instead of underscores **Structure:** - Thai translations added consistently across all locale files - Language selector updated in overview view - Auto-detection logic added for Thai browsers <h3>Confidence Score: 1/5</h3> - This PR contains a critical breaking bug that will break existing language translations - While the Thai translations themselves are well-structured and complete, the change to `translate.ts:63` from `module[locale.replace("-", "_")]` to `module[locale]` introduces a critical regression. All existing locales with hyphens (`pt-BR`, `zh-CN`, `zh-TW`) export their translation maps with underscores (`pt_BR`, `zh_CN`, `zh_TW`), so this change breaks module loading for these languages. This is a logic error that will cause runtime failures when users try to switch to Portuguese or Chinese. - Pay critical attention to `ui/src/i18n/lib/translate.ts:63` - this line must be reverted to preserve existing locale loading <sub>Last reviewed commit: 6816bc7</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs