Skip to content

♻️ Refactor i18n: use short keys in t9n() function#373

Merged
ebullient merged 1 commit intomainfrom
claude/dreamy-shtern
Mar 29, 2026
Merged

♻️ Refactor i18n: use short keys in t9n() function#373
ebullient merged 1 commit intomainfrom
claude/dreamy-shtern

Conversation

@ebullient
Copy link
Copy Markdown
Owner

Changes

  • Renamed translation function from t() to t9n() for clarity

  • Restructured en.ts locale file with hierarchical short keys instead of full strings:

    • Settings headings: heading.*
    • Export/Import: export-*, import.*, use-snippet.*
    • Feature toggles: drop-shadow.*, collapsible.*, collapse-type.*, etc.
    • Buttons: btn.save, btn.edit, btn.delete, etc.
    • Validation errors: error.type-empty, error.icon-invalid, etc.
    • Modal strings: modal.title.*, modal.collapsible.*
    • Per-admonition settings: admonition-type.name, admonition-title.*, etc.
  • Updated zh-cn.ts locale with partial translations using new key structure

  • Updated all imports and function calls throughout codebase to use t9n() instead of t()

  • Improved maintainability by centralizing all English strings in en.ts

Files Modified

  • src/lang/helpers.ts - Function rename
  • src/lang/locale/en.ts - Complete restructure with hierarchical keys
  • src/lang/locale/zh-cn.ts - Updated keys (partial translation)
  • src/settings.ts, src/modal/*.ts, src/util/validator.ts - Updated all t() calls to t9n()

@ebullient ebullient force-pushed the claude/dreamy-shtern branch from 44e3ad0 to d267e35 Compare March 29, 2026 14:45
@ebullient ebullient merged commit c227777 into main Mar 29, 2026
1 check passed
@ebullient ebullient deleted the claude/dreamy-shtern branch March 29, 2026 14:46
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.

🧩 Please update src/lang/locale/en.ts so that I can translate it into Chinese.

1 participant