Skip to content

完善本地化规则和导出,改用 NeoForge 注解扫描 - #12

Merged
QiuYe-QAQ merged 10 commits into
26.1from
qy/registratelib-localization-phase4-5
Nov 22, 2026
Merged

QiuYe-QAQ merged 10 commits into
26.1from
qy/registratelib-localization-phase4-5

Conversation

@QiuYe-QAQ

Copy link
Copy Markdown
Member

What / 目的

完善 26.1 的本地化规则、交换数据导出和 DataGen 扩展。复用 NeoForge 的注解扫描结果,让下游使用默认 JAR 配置即可打包本地化声明。

Implementation Details / 实现细节

  • 扩展本地化领域、词表关系、模块默认值和 Locale 派生规则。
  • 开放 DataGen Provider 扩展入口,增加按 Mod 配置的本地化交换 JSON 导出,记录源修订、术语和译文候选。
  • Java 和 Kotlin 的 @Trans 与 @TransVariants 均由 NeoForge 扫描收集。单 Mod 文件可以省略 modId,多 Mod 文件通过显式 modId 区分归属。
  • 将测试模组拆到 :test。Kotlin DataGen 使用 fastutil 列表和快速迭代,导出时按需创建条目,注解的显式 Locale 译文使用 EnumMap。

Outcome / 结果

  • IDEA 构建和离线 Gradle build 通过,包含 Spotless 检查。
  • :test:runGameTestServer 的 5 项测试全部通过。
  • 两个样例 Mod 的 :test:runTestdata 通过。集合调整前后,44 个生成资源与本地化交换 JSON 的 SHA-256 一致。
  • 主库 JAR 中未发现旧本地化索引。

Potential Compatibility Issues / 潜在兼容性问题

  • 下游继续使用原有注解,升级时移除 RegistrateLib 本地化处理器的 annotationProcessor 和 ksp 依赖。使用旧版本生成的索引由下游清理旧构建目录后移除。
  • 同一模组文件包含多个 Mod 时,两种注解都要求显式填写 modId。namespace 决定语言文件的输出位置。
  • 导出配置、交换格式和注解示例见迁移说明。本地化与迁移

@QiuYe-QAQ
QiuYe-QAQ requested a review from a team as a code owner November 22, 2026 11:16
@github-actions github-actions Bot added 26.1 Tests: Passed Game Tests have passed on this PR labels Nov 22, 2026
@QiuYe-QAQ QiuYe-QAQ added Release: API - X.0.0 Major Breaking Refactors that MUST be in a API-Breaking Release type: feature New feature or request bundled for a 0.X.0 Update labels Nov 22, 2026
@QiuYe-QAQ
QiuYe-QAQ merged commit 7be9715 into 26.1 Nov 22, 2026
5 of 7 checks passed
@QiuYe-QAQ
QiuYe-QAQ deleted the qy/registratelib-localization-phase4-5 branch November 22, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

26.1 Release: API - X.0.0 Major Breaking Refactors that MUST be in a API-Breaking Release Tests: Passed Game Tests have passed on this PR type: feature New feature or request bundled for a 0.X.0 Update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant