feat(i18n): add internationalization support with Chinese translation#2387
feat(i18n): add internationalization support with Chinese translation#2387yungle2023 wants to merge 1 commit into
Conversation
- Add i18n framework with automatic language detection based on Obsidian locale - Create translation files for English (en) and Simplified Chinese (zh-CN) - Add utility functions for localized messages - Update Chat.tsx to use translations for notice messages - Add translation keys for common UI strings (chat, messages, loading, project, model, settings, errors, tools) This addresses issue logancyang#2037 and provides a foundation for community-contributed translations.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c15ed53132
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Summary
Details
This PR implements the foundational i18n (internationalization) infrastructure for the Obsidian Copilot plugin, addressing issue #2037.
New Files
src/lang/en.ts- English translations (default)src/lang/zh-CN.ts- Simplified Chinese translationssrc/lang/i18n.ts- i18n core module with language detection and translation functionssrc/lang/index.ts- Module exportssrc/lang/langUtils.ts- Utility functions for localized messagesModified Files
src/components/Chat.tsx- Updated to uset()function for user-facing messagessrc/constants.ts- Added comment about localized loading messagesTranslation Keys
The following categories of strings are now translatable:
chat- Chat UI strings (new chat, send, save, etc.)messages- Notice messages (errors, confirmations)loading- Loading state messagesproject- Project-related messagesmodel- Model selection messagessettings- Settings messageserrors- Error messagestools- Tool namesplus- Copilot Plus relatedmisc- Miscellaneous stringsHow It Works
t("key.path")function for translationst("key", { name: "value" })Future Work
Closes #2037