The i18n implementation uses i18next. We chose this over chrome.i18n because the latter
does not support dynamic language switching. However, to meet the requirements of certain extension markets, we still
add chrome.i18n language files in the src/assets/_locales directory.
Language files are located in the src/locales directory and are divided by pages, with each page having a
corresponding language file. These files are ultimately merged and exported through locales.ts.
If keywords in a page are the same but their translations differ, you can distinguish them using the page.key format,
for example:
{
"list": {
"confirm_delete": "Are you sure you want to delete? Please note that this is an irreversible operation.",
"confirm_update": "Are you sure you want to update? Please note that this is an irreversible operation."
}
}For the translation workflow, terminology rules, and per-locale checklist, see
docs/translation.md — this file only covers the i18n implementation, not the
contribution workflow.
i18n 使用i18next实现,之所以不是用chrome.i18n的原因是该方案不支持动态切换语言。但是为了某些扩展市场的要求,我们还是在src/assets/_locales目录下添加了chrome.i18n的语言文件。
语言文件位于src/locales目录下,按照页面划分,每个页面对应一个语言文件,最终由locales.ts合并进行导出。
如果页面中的关键字一样,但是翻译不一样,可以使用page.key的方式进行区分,例如:
{
"list": {
"confirm_delete": "确定要删除吗?请注意这个操作无法恢复!",
"confirm_update": "确定要更新吗?请注意这个操作无法恢复!"
}
}翻译工作流、术语规则与逐语言检查清单见 docs/translation.md——本文件只覆盖 i18n
实现机制,不重复维护贡献流程。