Repository navigation
feat(i18n): 将中文错误信息改为多语言 i18n,并新增 @grant 冲突校验 - #819
Merged
Merged
Conversation
cyfung1031
force-pushed
the
pr-GM_editor_err_messages
branch
from
October 8, 2025 15:08
936094c to
4be5840
Compare
cyfung1031
force-pushed
the
pr-GM_editor_err_messages
branch
from
October 10, 2025 00:08
89db07f to
abbbeb6
Compare
Member
|
也许也可以把这个问题加入这个PR |
Collaborator
Author
改哪裡?我不熟。你可以直接加commit |
CodFrm
reviewed
Oct 10, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
本 PR 的目的是将脚本处理逻辑中的中文硬编码错误信息替换为多语言 i18n 键值,并新增对无效 @grant 声明的校验。
- 替换了
prepareScriptByCode和prepareSubscribeByCode函数中的所有中文硬编码错误信息为 i18n 调用 - 新增了对同时声明
@grant none和 GM API 的冲突校验逻辑,仅在编辑器更新时触发 - 在所有 7 个语言包中添加了相应的错误信息翻译键值
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/pkg/utils/script.ts |
核心修改:替换中文错误信息为 i18n 调用,新增 @grant 冲突校验逻辑,增加 options 参数 |
src/pages/options/routes/script/ScriptEditor.tsx |
更新函数调用以传递 byEditor: true 选项,启用编辑器特定的校验 |
src/locales/*/translation.json |
在所有 7 个语言包中添加新的错误信息翻译键值 |
src/app/service/service_worker/synchronize.ts |
将硬编码的通知信息替换为 i18n 调用 |
src/app/service/service_worker/subscribe.ts |
将硬编码的通知信息替换为 i18n 调用 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
本次 PR 将脚本处理逻辑中的所有中文硬编码错误信息替换为 i18n 多语言键值(以
error_为前缀),并新增对无效@grant声明的校验。主要修改内容
替换以下函数中的中文错误信息为 i18n 调用:
prepareScriptByCodeprepareSubscribeByCode新增
@grant校验逻辑,防止同时声明none与 GM API:新增多语言键值:
error_grant_conflict:@grant 同时声明了 none 和 GM API更新所有 7 个语言包:
zh-CN,zh-TW,en-US,ja-JP,vi-VN,de-DE,ru-RU,占位符格式统一为
{{expr}}。影响
@grant none时仍使用 GM API 的错误用法。测试
i18n_t()正确输出本地化信息。