From c1aa5f7385469383d599204d1cda0320afea14df Mon Sep 17 00:00:00 2001 From: MaxZhang <373884384@qq.com> Date: Thu, 3 Jul 2025 11:40:51 +0800 Subject: [PATCH 1/3] Update i18n README.md --- src/locales/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/locales/README.md b/src/locales/README.md index a0aebcaba..0970d2624 100644 --- a/src/locales/README.md +++ b/src/locales/README.md @@ -1,3 +1,21 @@ +# i18n Solution + +The i18n implementation uses [i18next](https://www.i18next.com/). 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 + +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`. + +## Keyword Conflicts + +If keywords in a page are the same but their translations differ, you can distinguish them using the `page.key` format, for example: + +```yaml +list: + confirm_delete: Are you sure you want to delete? Please note that this action cannot be undone! +``` + + # i18n 方案 i18n 使用[i8next](https://www.i18next.com/)实现,之所以不是用`chrome.i18n`的原因是该方案不支持动态切换语言。但是为了某些扩展市场的要求,我们还是在`src/assets/_locales`目录下添加了`chrome.i18n`的语言文件。 From d32b70b09eca214ae7e41955ff7ab25ab84f41e2 Mon Sep 17 00:00:00 2001 From: MaxZhang <373884384@qq.com> Date: Thu, 3 Jul 2025 11:49:58 +0800 Subject: [PATCH 2/3] Update README.md --- src/locales/README.md | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/locales/README.md b/src/locales/README.md index 0970d2624..c1609f344 100644 --- a/src/locales/README.md +++ b/src/locales/README.md @@ -10,9 +10,18 @@ Language files are located in the `src/locales` directory and are divided by pag If keywords in a page are the same but their translations differ, you can distinguish them using the `page.key` format, for example: -```yaml -list: - confirm_delete: Are you sure you want to delete? Please note that this action cannot be undone! + +## Crowdin + +[Crowdin](https://crowdin.com/project/scriptcat) + +```json +{ + "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." + } +} ``` @@ -28,7 +37,16 @@ i18n 使用[i8next](https://www.i18next.com/)实现,之所以不是用`chrome. 如果页面中的关键字一样,但是翻译不一样,可以使用`page.key`的方式进行区分,例如: -```yaml -list: - confirm_delete: 确定要删除吗?请注意这个操作无法恢复! +## Crowdin + +[Crowdin](https://crowdin.com/project/scriptcat) + + +```json +{ + "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." + } +} ``` From 1f9e6e05e677ca7197282ccc749c3fbda596655b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=B8=80=E4=B9=8B?= Date: Thu, 3 Jul 2025 17:25:58 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=8C=90=20Adjust=20locales=20Readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/README.md | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/locales/README.md b/src/locales/README.md index c1609f344..a5c35334f 100644 --- a/src/locales/README.md +++ b/src/locales/README.md @@ -1,29 +1,35 @@ # i18n Solution -The i18n implementation uses [i18next](https://www.i18next.com/). 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. +The i18n implementation uses [i18next](https://www.i18next.com/). 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 -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`. +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`. ## Keyword Conflicts -If keywords in a page are the same but their translations differ, you can distinguish them using the `page.key` format, for example: - - -## Crowdin - -[Crowdin](https://crowdin.com/project/scriptcat) +If keywords in a page are the same but their translations differ, you can distinguish them using the `page.key` format, +for example: ```json { - "list": { + "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." } } ``` +### Help Us Translate + +[Crowdin](https://crowdin.com/project/scriptcat) +is an online localization platform that helps us manage translations. If you're interested in helping us translate ScriptCat, you can find the project on Crowdin and start contributing. + +- `src/locales` is the translation file directory for the [extension](https://github.com/scriptscat/scriptcat) +- `public/locales` is the translation file directory for the [script website](https://github.com/scriptscat/scriptlist-frontend) # i18n 方案 @@ -37,16 +43,19 @@ i18n 使用[i8next](https://www.i18next.com/)实现,之所以不是用`chrome. 如果页面中的关键字一样,但是翻译不一样,可以使用`page.key`的方式进行区分,例如: -## Crowdin - -[Crowdin](https://crowdin.com/project/scriptcat) - - ```json { - "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." + "list": { + "confirm_delete": "确定要删除吗?请注意这个操作无法恢复!", + "confirm_update": "确定要更新吗?请注意这个操作无法恢复!" } } ``` + +### 帮助我们翻译 + +[Crowdin](https://crowdin.com/project/scriptcat) +是一个在线的多语言翻译平台。如果您有兴趣帮助我们翻译 ScriptCat 的相关内容,您可以在 Crowdin 上找到 ScriptCat 项目,并开始进行翻译工作。 + +- `src/locales`为[扩展](https://github.com/scriptscat/scriptcat)翻译文件目录 +- `public/locales`为[脚本站](https://github.com/scriptscat/scriptlist-frontend)的翻译文件目录