Skip to content

chore: improve i18n workflow with semantic__type suffix convention#10131

Merged
huhuanming merged 11 commits intoOneKeyHQ:xfrom
PatrickChoo:chore/i18n-workflow-improvement
Mar 11, 2026
Merged

chore: improve i18n workflow with semantic__type suffix convention#10131
huhuanming merged 11 commits intoOneKeyHQ:xfrom
PatrickChoo:chore/i18n-workflow-improvement

Conversation

@PatrickChoo
Copy link
Copy Markdown
Collaborator

@PatrickChoo PatrickChoo commented Feb 11, 2026

Summary

  • Unified naming convention: All i18n docs now use {semantic_key}__{type} suffix format (e.g. send__title, confirm_send__action)
  • Added CLI tools: i18n:search for local key lookup, i18n:add for Lokalise API, renamed fetch:localei18n:pull
  • Slimmed CLAUDE.md: i18n section condensed, pointing to /1k-i18n skill for details
Screenshot 2026-03-10 at 21 31 32 Screenshot 2026-03-10 at 21 34 33

4 type suffixes

Suffix Case Usage
__title Title Case Page/dialog title, form label
__action Title Case Button, menu item, tab, link
__desc Sentence case Description, placeholder, hint
__msg Sentence case Error, toast, alert

Note on auto-generated files

translations.ts and localeJsonMap.ts have a comment change (yarn fetch:localeyarn i18n:pull). The build template in build-locale-json-map.js was also updated, so next i18n:pull run will produce consistent output. This is an intentional one-time sync.

Test plan

  • yarn workspace @onekeyhq/shared i18n:search "send" works with suffix detection
  • yarn workspace @onekeyhq/shared i18n:add send__title "Send" validates suffix format
  • yarn workspace @onekeyhq/shared i18n:pull syncs correctly
  • No build breakage from renamed scripts

🤖 Generated with Claude Code

@revan-zhang
Copy link
Copy Markdown
Contributor

revan-zhang commented Feb 11, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@huhuanming huhuanming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review comments (issues #3 and #4 from review)

Comment thread .claude/skills/1k-i18n/SKILL.md Outdated
Comment thread packages/shared/src/locale/enum/translations.ts
@PatrickChoo PatrickChoo force-pushed the chore/i18n-workflow-improvement branch 2 times, most recently from 88f3b16 to 7454b35 Compare February 11, 2026 04:30
devin-ai-integration[bot]

This comment was marked as resolved.

@PatrickChoo PatrickChoo force-pushed the chore/i18n-workflow-improvement branch from 7454b35 to 0ca1bad Compare February 11, 2026 04:36
huhuanming
huhuanming previously approved these changes Feb 12, 2026
@socket-security
Copy link
Copy Markdown

socket-security bot commented Feb 24, 2026

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

Comment thread packages/shared/package.json Outdated
@boring-claw
Copy link
Copy Markdown

🔍 Code Review Report

检查时间: 2026-02-25 05:00 CST

变更摘要:

  • 改进 i18n 工作流,引入语义化命名约定 {semantic_key}__{type}
  • 新增 CLI 工具: i18n:searchi18n:add
  • 更新技能文档和开发规范
  • 添加 dotenv 依赖支持

Review 意见:

优点:

  1. 命名约定清晰 - __title/__action/__desc/__msg 四类后缀与 Apple HIG 对齐,语义明确
  2. 向后兼容 - 明确说明旧 key 保持有效,无需迁移,降低风险
  3. 工具完善 - i18n:searchi18n:add 脚本提升了开发者体验
  4. 文档详尽 - SKILL.md 和 i18n.md 的更新非常全面,包含使用示例和最佳实践

⚠️ 建议:

  1. 建议为新增的 i18n-add.jsi18n-search.js 添加单元测试,确保脚本稳定性
  2. i18n:add 命令涉及 Lokalise API 调用,建议添加错误重试机制和详细的错误提示
  3. 考虑在 CI 中添加 key 命名规范检查,自动拦截不符合新规范的 key

总体评价: LGTM 👍 这是一个组织良好的改进,提升了 i18n 工作流的可维护性。


Reviewed by BoringClaw 🤖

@PatrickChoo PatrickChoo force-pushed the chore/i18n-workflow-improvement branch from b9b87ba to be1ad8f Compare February 25, 2026 06:57
originalix
originalix previously approved these changes Feb 27, 2026
Comment thread package.json
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

graphite-app[bot]

This comment was marked as resolved.

@PatrickChoo PatrickChoo force-pushed the chore/i18n-workflow-improvement branch from c31e9ab to aeb0ee7 Compare March 10, 2026 13:39
… placeholder validation

- Add i18n:add script to create Lokalise keys with semantic__type suffix convention
- Add i18n:search script for searching existing translation keys
- Rename fetch:locale to i18n:pull for consistent naming
- Use 1Password CLI (yarn op) for secrets instead of dotenv
- Add ICU placeholder extraction and en/zh mismatch validation
- Add root-level yarn i18n:add, i18n:search, i18n:pull shortcuts
- Update CLAUDE.md, SKILL.md, AGENTS.md docs with new CLI commands
Shared package is for app runtime code. Dev tooling scripts belong
in development/scripts/ alongside other build and CI scripts.
- Fix grouping to use full semantic prefix before __ instead of first word only
- Update next-step hint to use root-level yarn i18n:pull command
@PatrickChoo PatrickChoo force-pushed the chore/i18n-workflow-improvement branch from aeb0ee7 to 396bf2c Compare March 10, 2026 13:43
originalix
originalix previously approved these changes Mar 10, 2026
@originalix originalix enabled auto-merge (squash) March 10, 2026 15:38
huhuanming
huhuanming previously approved these changes Mar 11, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
auto-merge was automatically disabled March 11, 2026 05:26

Head branch was pushed to by a user without write access

@PatrickChoo PatrickChoo dismissed stale reviews from huhuanming and originalix via 18383ac March 11, 2026 05:26
devin-ai-integration[bot]

This comment was marked as resolved.

PatrickChoo and others added 3 commits March 11, 2026 18:56
- Wrap JSON.parse in try/catch to prevent uncaught exception on malformed API response
- Add .catch() handler on main() to prevent unhandled promise rejection
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

View 15 additional findings in Devin Review.

Open in Devin Review

Comment thread packages/shared/src/locale/enum/translations.ts
Comment thread packages/shared/src/locale/localeJsonMap.ts
@huhuanming huhuanming merged commit 8b43d0e into OneKeyHQ:x Mar 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants