feat: Italian game language support (OCR + language list) - #3399
Conversation
All strings taken verbatim from the official Italian game text (TextMap), mapped key-by-key from the existing French resx files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Italian already maps to the V5Latin OCR model in PaddleOcrService. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Tolerant regex patterns for layout-dependent and inflected strings, official TextMap values for expedition and fishing hook strings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough新增意大利语本地化支持。语言设置、应用界面、自动任务资源和 OCR 测试均加入意大利语内容。 Changes意大利语本地化
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile Summary本 PR 为游戏语言和界面语言列表加入意大利语,并补充意大利语 OCR、本地化资源及测试。
Confidence Score: 5/5当前没有仍需阻止合并的已确认故障,PR 看起来可以安全合并。 没有阻塞性故障仍然存在。
|
| Filename | Overview |
|---|---|
| BetterGenshinImpact/ViewModel/Pages/CommonSettingsPageViewModel.cs | 将 it 加入统一的界面及游戏语言选择列表,现有选择流程可正常传递该文化代码。 |
| BetterGenshinImpact/View/Converters/CultureInfoNameToKVPConverter.cs | 为 it 增加 “Italiano” 显示名称,与语言列表注册保持一致。 |
| BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.it.resx | 增加意大利语秘境 OCR 文本,并沿用现有基于正则的容错匹配方式。 |
| BetterGenshinImpact/User/I18n/it.json | 新增意大利语 UI 翻译资源。 |
| Test/BetterGenshinImpact.UnitTest/CoreTests/RecognitionTests/OCRTests/PaddleOcrServiceTests.cs | 增加多项意大利语 OCR 样例,覆盖本 PR 引入的主要识别文本。 |
Reviews (5): Last reviewed commit: "fix: tolerant patterns for limited-time ..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf840aeaba
ℹ️ 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".
| <data name="跳过" xml:space="preserve"> | ||
| <value>Salta</value> |
There was a problem hiding this comment.
严重程度:P2。问题位置:AutoDomainTask.it.resx 的意大利语资源列表只到这些基础 OCR 文案;问题原因:AutoDomainTask 构造函数还会读取 限时全部开放/限时开放,并在秘境入口用 Regex.IsMatch 判断是否处于限时全开状态,缺少 Italian 资源时 IStringLocalizer 会回落成中文 key。可能造成的影响:当游戏语言设为 Italian 且秘境在非周日的“限时全部开放”活动状态下运行自动秘境时,检测不到 all-open,后续不会按 SundaySelectedValue 选择奖励,可能刷错材料。推荐修复方案:为 限时全部开放 和 限时开放 增加意大利语 OCR 正则(必要时也补齐已声明的 匹配挑战/快速编队)。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f0bbaee: added 快速编队 ("Configurazione rapida", single unambiguous TextMap hash, matches the button label used elsewhere in the repo) and both 限时开放/限时全部开放 ("Disponibile per un periodo limitato" / "Accesso completo a tempo limitato", the latter derived from the 限时全部开放:{0} variant with the placeholder stripped). 匹配挑战 was left out: TextMap gives two different Italian translations across its 3 CHS-exact hashes ("Matchmaking" 2/3 vs "Cooperativa" 1/3, FR uses "Matchmaking" for all 3 so it doesn't disambiguate), so no univocal source string — didn't want to guess. Also note matchingChallengeString/rapidformationString aren't referenced anywhere in AutoDomainTask.cs beyond the constructor, so this is currently a dead field with no runtime impact; happy to add 匹配挑战 in a follow-up once someone can confirm in-game which of the two candidates is shown.
| <data name="上钩" xml:space="preserve"> | ||
| <value>preso</value> |
There was a problem hiding this comment.
严重程度:P2。问题位置:AutoFishingTask.it.resx 的 上钩 OCR 关键词;问题原因:FishBite.Update 会对识别文本执行 RemoveAllSpace(...).Contains(this.getABiteLocalizedString),但这里配置成 preso,而意大利语游戏文案中的上钩提示是 Ha abboccato!(HoYoWiki: https://wiki.hoyolab.com/pc/genshin/entry/7005?lang=it-it)。可能造成的影响:在 Italian 游戏语言下,如果前面的文字块/按钮图像识别没有命中,OCR 兜底永远不会触发提竿,自动钓鱼会一直等到超时。推荐修复方案:将该值改为可匹配 abboccato 的关键词或正则,并保持与 StringUtils.RemoveAllSpace 后的文本一致。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f0bbaee with "bboccato": "preso" matched the catch message (鱼儿上钩啦! → "Hai preso qualcosa!"), while the bite prompt is a different string (喂!鱼上钩了! → "Ehi! Qualcosa ha abboccato!", confirmed via TextMap and HoYoWiki it-it). Used the case-safe substring "bboccato" against the RemoveAllSpace-normalized text, same convention as the fr resx.
|
|
||
| [ObservableProperty] private FrozenDictionary<string, string> _languageDict = | ||
| new[] { "zh-Hans", "zh-Hant", "en", "ja" } | ||
| new[] { "zh-Hans", "zh-Hant", "en", "ja", "it" } |
There was a problem hiding this comment.
严重程度:P2。问题位置:新增的 it 游戏语言入口;问题原因:领取尘歌壶奖励 会实例化 GoToSereniteaPotTask,该任务通过 IStringLocalizer<GoToSereniteaPotTask> 匹配 阿圆、壶灵、信任、洞天百宝 等 OCR 文案,但仓库中没有任何 GoToSereniteaPotTask.*.resx(已用 rg --files 检查),所以 Italian 会全部回落成中文。可能造成的影响:用户选择 Italian 后运行一条龙里的尘歌壶奖励时,找不到阿圆或对话选项,任务会失败或空转。推荐修复方案:在把 it 暴露为可选游戏语言的同时,补齐 GoToSereniteaPotTask.it.resx(或在该任务中明确禁用/回退到支持的语言)。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This task has no resx for any non-Chinese locale (en/fr/it all missing GoToSereniteaPotTask.*.resx, verified with rg --files) — it's a pre-existing gap affecting every non-Chinese language, not something introduced by exposing it. Out of scope for this PR; happy to file a follow-up PR to add it once the base localization here is merged.
- 上钩: "preso" matched the catch message, not the bite prompt
("Ha abboccato!") — use case-safe substring "bboccato"
- AutoDomainTask: add Italian values for 匹配挑战/快速编队/限时全部开放/限时开放,
which the task reads but no non-Chinese locale currently provides
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f0bbaee5af
ℹ️ 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".
|
|
||
| [ObservableProperty] private FrozenDictionary<string, string> _languageDict = | ||
| new[] { "zh-Hans", "zh-Hant", "en", "ja" } | ||
| new[] { "zh-Hans", "zh-Hant", "en", "ja", "it" } |
There was a problem hiding this comment.
严重程度:P2。问题位置:新增的 it 被放进同一个 LanguageDict,而该字典同时驱动“UI Language”和“Game Language”下拉框;问题原因:JsonTranslationService.LoadMap 只会读取 User\I18n\it.json,但本提交没有加入该文件(仓库当前仅随包提供 en.json/ja.json),用户初次或离线切到 Italian UI 时翻译表为空。可能造成的影响:界面仍显示中文,新增的 Italian UI 选项实际不可用。推荐修复方案:随提交补齐 BetterGenshinImpact/User/I18n/it.json,或拆分 UI 语言和游戏 OCR 语言列表,只在 UI 翻译文件可用时暴露 UI 选项。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 4662754: added BetterGenshinImpact/User/I18n/it.json (864 entries, from the companion bettergi-i18n PR) alongside en.json/ja.json, so the Italian UI option now has a translation table on first run/offline. It's already covered by the existing User\** CopyToOutputDirectory wildcard in the csproj, same as ja.json, so no extra project entry was needed.
| <data name="今日奖励已领取" xml:space="preserve"> | ||
| <value>Ricompense giornaliere riscattate</value> |
There was a problem hiding this comment.
严重程度:P2。问题位置:CheckRewardsTask.it.resx 只新增了最终“已领取”文案;问题原因:CheckRewardsTask.Start 进入冒险之证时仍使用硬编码中文 GetConfirmRa(true,"每日委托奖励") 和 btn.Text == "委托",Italian 游戏界面不会出现这些 OCR 文本,前置等待会超时且后续检查不在正确页面上进行。可能造成的影响:Italian 语言下运行检查每日奖励/通知时容易误报“未领取”或无法正确打开委托页。推荐修复方案:把“每日委托奖励”和“委托”也加入本地化资源,并在该任务中使用对应的 Italian 正则匹配。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed, but this is a pre-existing gap across the whole multi-language system, not introduced by this PR: CheckRewardsTask.cs:57,63 hardcode the Chinese OCR targets ('每日委托奖励', '委托') directly in the call sites, and no locale (including fr/en) supplies alternatives. A real fix needs refactoring those call sites to use localized keys for every language, which is out of scope here — happy to tackle it in a follow-up PR.
| <data name="快速编队" xml:space="preserve"> | ||
| <value>Configurazione rapida</value> |
There was a problem hiding this comment.
严重程度:P2。问题位置:AutoDomainTask.it.resx 新增了 Italian 秘境 OCR 资源,但没有覆盖进入战斗前的按钮文案;问题原因:EnterDomain 后续仍以 GetConfirmRa("开始挑战") 作为点击开始前的门禁,而 WaitForElementDisappear 在 Italian 界面找不到中文文本时会直接返回,导致内部点击确认按钮的回调不执行。可能造成的影响:Italian 游戏语言下进入队伍界面后不会点击 Inizia la sfida,自动秘境会卡在队伍界面或后续等待战斗失败。推荐修复方案:为 开始挑战(以及需要等待的 单人挑战)增加 Italian 资源并在调用处使用本地化文本,或改成不依赖中文 OCR 的模板按钮点击。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed, but same as the CheckRewardsTask case: AutoDomainTask.cs:111-118 (GetConfirmRa for '开始挑战' / '单人挑战') hardcodes the Chinese OCR targets in the code itself, and no non-Chinese locale (fr/en included) provides them — a pre-existing gap in the multi-language system, not introduced by this PR. Fixing it properly means refactoring those call sites plus adding keys for every language, which I'll leave for a follow-up PR.
| <data name="挑战达成" xml:space="preserve"> | ||
| <value>Sfida completata</value> |
There was a problem hiding this comment.
严重程度:P2。问题位置:挑战达成 的 Italian OCR 资源;问题原因:IsDomainEnd 对 OCR 原文直接执行 Regex.IsMatch(text, challengeCompletedLocalizedString),但这里配置成带固定空格的 Sfida completata,不像其他语言和新增测试那样使用 Sfida.*completata 容忍 OCR 丢空格/插入分隔符。可能造成的影响:Italian 语言下秘境结束提示被识别成 Sfidacompletata 或类似无空格文本时,自动秘境无法及时判断挑战结束,继续等待直到后续超时。推荐修复方案:把该值改为 Sfida.*completata 或只匹配 completata 等更稳健的正则。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 4662754: changed the 挑战达成 value to (Sfida|completata), mirroring the French tolerant pattern (Défi|terminé) instead of the rigid literal string, and aligned the OCR test pattern in PaddleOcrServiceTests.cs to match.
| <data name="快速选择" xml:space="preserve"> | ||
| <value>Selezione rapida</value> |
There was a problem hiding this comment.
严重程度:P2。问题位置:快速选择 的 Italian OCR 资源;问题原因:AutoArtifactSalvageTask 会用 Regex.IsMatch(ocr.Text, quickSelectLocalizedString) 找快速选择按钮,英文和法文资源都用 .* 容忍 OCR 断词,但这里写成固定的 Selezione rapida,而本提交自己的 OCR 测试也用 Selezione.*rapida 作为 Italian 期望模式。可能造成的影响:Italian 游戏语言下按钮被识别为 Selezionerapida 或带换行/多空格时,自动圣遗物分解无法点击快速选择并中断。推荐修复方案:将该值改为 Selezione.*rapida。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 4662754: changed the 快速选择 value to Selezione.*rapida, matching the French pattern (Sélection.*rapide) and the existing OCR test expectation which already used Selezione.*rapida.
…I translation - 挑战达成/快速选择: mirror the French tolerant patterns - ship User/I18n/it.json like en/ja so the Italian UI option works on first run and offline Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@BetterGenshinImpact/User/I18n/it.json`:
- Around line 137-139: Update the affected Italian localization fragments at the
shown entries to preserve their required leading or trailing spaces when
concatenated with keys, buttons, inputs, and paths: add the missing leading
spaces for the fragments near “后才进行快速传送” and line 272, and missing trailing
spaces near lines 327 and 378. Keep the translated wording unchanged unless
converting a fragment into a complete sentence.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 99c2bd79-28c8-4c81-b28c-cb471c0f60be
📒 Files selected for processing (4)
BetterGenshinImpact/GameTask/AutoArtifactSalvage/AutoArtifactSalvageTask.it.resxBetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.it.resxBetterGenshinImpact/User/I18n/it.jsonTest/BetterGenshinImpact.UnitTest/CoreTests/RecognitionTests/OCRTests/PaddleOcrServiceTests.cs
🚧 Files skipped from review as they are similar to previous changes (3)
- Test/BetterGenshinImpact.UnitTest/CoreTests/RecognitionTests/OCRTests/PaddleOcrServiceTests.cs
- BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.it.resx
- BetterGenshinImpact/GameTask/AutoArtifactSalvage/AutoArtifactSalvageTask.it.resx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4662754607
ℹ️ 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".
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
| </resheader> | ||
| <data name="今日奖励已领取" xml:space="preserve"> | ||
| <value>Ricompense giornaliere riscattate</value> |
There was a problem hiding this comment.
严重程度:P2。问题位置:CheckRewardsTask.it.resx 的 今日奖励已领取。问题原因:CheckRewardsTask.Start 把该值传给 RecognitionObject.OcrMatch,而 ImageRegion 在匹配前会对 OCR 结果执行 StringUtils.RemoveAllSpace(result.Text),所以实际文本会变成 Ricompensegiornaliereriscattate,无法包含这里带空格的 Ricompense giornaliere riscattate。可能造成的影响:Italian 游戏语言下即使已经在委托奖励页(或后续修复入口匹配后),已领取状态也会被判定为未领取并发送误报。推荐修复方案:把资源改成无空格的匹配串,或使用更短且无空格的关键词如 riscattate。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 1720f78 — stripped the spaces from the Italian value for 今日奖励已领取 (now "riscattate"), matching the space-free EN/FR convention for OcrMatch.
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
| </resheader> | ||
| <data name="地脉异常" xml:space="preserve"> | ||
| <value>Anomalia geomantica</value> |
There was a problem hiding this comment.
严重程度:P2。问题位置:AutoDomainTask.it.resx 的 地脉异常。问题原因:AutoDomainTask 在选择周日/限时全开奖励和关闭秘境提示时都会用 Regex.IsMatch(t.Text, this.leyLineDisorderLocalizedString) 匹配该资源,但这里写成固定空格的 Anomalia geomantica,而本提交新增的 OCR 测试已经按 Anomalia.*geomantica 预期来容忍空格丢失;当 OCR 返回 Anomaliageomantica 时资源不会命中。可能造成的影响:Italian 语言下秘境提示无法稳定识别,周日奖励定位可能失效,进入战斗前关闭提示也可能多等到超时或误点兜底位置。推荐修复方案:改成无空格关键词(如 geomantica,同时兼容现有 Contains 调用)或同步修改调用处统一使用可容忍空格的正则。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 1720f78 — changed 地脉异常 to the tolerant pattern "Anomalia.*geomantica", matching the fr convention (Anomalie.*énergétique); no test asserted the old literal value.
…in it.json Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1720f78096
ℹ️ 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".
| <value>Disponibile per un periodo limitato</value> | ||
| </data> | ||
| <data name="限时全部开放" xml:space="preserve"> | ||
| <value>Accesso completo a tempo limitato</value> |
There was a problem hiding this comment.
严重程度:P2。问题位置:AutoDomainTask.it.resx 的 限时开放/限时全部开放;问题原因:当前最终提交虽然已经补上这两个键,但值仍是带字面空格的长短语,而 AutoDomainTask 在秘境入口直接用 Regex.IsMatch(t.Text, ...) 判断限时全开,提交中新增的 OCR 测试也显示意大利语多词文本需要用 .* 容忍空格丢失。可能造成的影响:Italian 游戏语言下如果 OCR 把 Accesso completo a tempo limitato 识别成无空格或断词变体,限时全开不会被识别,非周日活动期间不会按 SundaySelectedValue 选择奖励,可能刷错材料。推荐修复方案:把这两个值改成类似 Disponibile.*per.*un.*periodo.*limitato / Accesso.*completo.*a.*tempo.*limitato,或在调用处统一对 OCR 文本去空格后匹配。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f104f0f — changed 限时开放 and 限时全部开放 to tolerant patterns (Disponibile.*per.*un.*periodo.*limitato / Accesso.*completo.*a.*tempo.limitato), consistent with the . convention used elsewhere for Regex.IsMatch matches.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@
What
Adds Italian as a selectable UI/game language:
.resxsatellite files for all game-text string groups (11 files, 46 strings), taken verbatim from the official Italian game text (TextMap), mapped key-by-key from the French resx files."it"added to the language list and toCultureInfoNameToKVPConverter("Italiano").PaddleOcrServiceTests. No model changes needed:"it"already maps to the V5Latin model.Testing
dotnet testgreen, including new Italian OCR cases.中文摘要
为 BGI 添加意大利语支持:新增意大利语 .resx 资源文件(游戏文本取自官方意大利语文本映射)、语言列表加入 "it"(OCR 已支持 V5Latin 模型)、补充相应单元测试。已在意大利语客户端实测(跳过剧情、自动拾取、完整秘境)。
🤖 Generated with Claude Code
@
Summary by CodeRabbit
新功能
测试