Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌐 i18n国际化 #188 #202

Merged
merged 7 commits into from
Jun 16, 2023
Merged

🌐 i18n国际化 #188 #202

merged 7 commits into from
Jun 16, 2023

Conversation

CodFrm
Copy link
Member

@CodFrm CodFrm commented Jun 16, 2023

i18n 方案

i18n 使用i8next实现,之所以不是用chrome.i18n的原因是该方案不支持动态切换语言。但是为了某些扩展市场的要求,我们还是在build/assets/_locales目录下添加了chrome.i18n的语言文件。

初版使用ChatGPT进行整理,目前支持以下语种:

  • 简体中文
  • English

语言文件

语言文件位于src/locales目录下,按照页面划分,每个页面对应一个语言文件,最终由index.ts合并进行导出。

关键字冲突

如果页面中的关键字一样,但是翻译不一样,可以使用page.key的方式进行区分,例如:

list:
  confirm_delete: 确定要删除吗?请注意这个操作无法恢复!

@CodFrm CodFrm changed the title i 🌐 i18n国际化 #188 Jun 16, 2023
@CodFrm CodFrm merged commit d0e6ef0 into main Jun 16, 2023
3 checks passed
@CodFrm CodFrm deleted the develop/i18n branch June 16, 2023 16:54
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.

None yet

1 participant