Skip to content

feat(i18n): sort translation files#2461

Merged
SkrubbySkrubInAShrub merged 2 commits into
devfrom
i18n-sort
Jun 3, 2026
Merged

feat(i18n): sort translation files#2461
SkrubbySkrubInAShrub merged 2 commits into
devfrom
i18n-sort

Conversation

@jiayev

@jiayev jiayev commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

This pull request adds a new tool and related workflow improvements to ensure all non-English translation files have their keys ordered to match en.json, making translation maintenance and review easier. It also updates translation keys for the Screen Space GI feature to use a consistent prefix.

Translation workflow improvements:

  • Added tools/sort-i18n.py, a script that checks and optionally rewrites translation files so their keys match the order in en.json. The script can be run manually or in CI, and the ordering rules are clearly documented.
  • Updated the CI workflow (.github/workflows/pr-i18n.yaml) to run sort-i18n.py --check on pull requests, ensuring translation files stay in sync with the reference key order. [1] [2]
  • Improved documentation in .claude/CLAUDE.md and TRANSLATING.md to describe the new key ordering requirement, how to check/fix it, and the rationale. [1] [2] [3]

Translation key updates:

  • Renamed all feature.ssgi.* translation keys to feature.screen_space_gi.* in en.json for consistency with the codebase and updated the C++ source accordingly. [1] [2] [3]

Summary by CodeRabbit

  • Chores

    • Added CI check and a CLI tool to verify and fix translation key ordering for consistent localization files.
  • Documentation

    • Expanded contributor docs with key-ordering rules and commands for validating/fixing translations.
  • Localization

    • Reworked Screen Space GI translation keys and updated UI strings/tooltips to use the new key namespace.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 54ef1bb7-ee39-42c1-b8ab-3817c695464a

📥 Commits

Reviewing files that changed from the base of the PR and between f675e16 and 7079428.

📒 Files selected for processing (2)
  • package/SKSE/Plugins/CommunityShaders/Translations/en.json
  • package/SKSE/Plugins/CommunityShaders/Translations/zh_CN.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • package/SKSE/Plugins/CommunityShaders/Translations/en.json

📝 Walkthrough

Walkthrough

Adds a Python CLI to validate/reorder translation JSON key order, renames Screen Space GI translation keys and expands English strings, and integrates the ordering check into CI with documentation and local run instructions.

Changes

Translation Key Ordering and Screen Space GI Migration

Layer / File(s) Summary
i18n Translation Sorting Tool
tools/sort-i18n.py
New sort-i18n.py CLI utility validates translation JSON key ordering by loading the English reference file, checking each translation file's key sequence, and optionally rewriting misordered files or failing CI checks.
Screen Space GI Translation Key Migration
src/Features/ScreenSpaceGI.cpp, package/SKSE/Plugins/CommunityShaders/Translations/en.json
Renames the feature's i18n namespace from feature.ssgi.* to feature.screen_space_gi.*, updates the C++ key prefix constant, expands English translations with comprehensive UI labels and tooltips, and removes the deprecated ssgi key block.
CI Validation and Documentation
.github/workflows/pr-i18n.yaml, TRANSLATING.md, .claude/CLAUDE.md
Adds a translation key order check step to the PR workflow (triggered on tools/sort-i18n.py changes), documents the required key ordering discipline in contributor guidelines, and provides local --check and --write command examples in development notes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • alandtse
  • doodlum

🐰 Scripts that sort the keys with care,
Ensure translations everywhere fair,
From SSGI's old name to new fame,
Screen Space GI shines bright—same game!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: adding a tool to sort translation files and enforce consistent key ordering across translation JSON files.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch i18n-sort

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 OpenGrep (1.22.0)

OpenGrep fatal error (exit code 2): [00.18][ERROR]: Error: exception Unix_error: No such file or directory stat package/SKSE/Plugins/CommunityShaders/Translations/en.json
Raised by primitive operation at UTmp.replace_named_pipe_by_regular_file_if_needed in file "libs/commons/UTmp.ml", line 145, characters 8-27
Called from Scan_CLI.replace_target_roots_by_regular_files_where_needed.(fun) in file "src/osemgrep/cli_scan/Scan_CLI.ml", lines 1086-1087, characters 19-65
Called from List_.fast_map in file "libs/commons/List_.ml", line 81

🔧 Checkov (3.2.530)
package/SKSE/Plugins/CommunityShaders/Translations/zh_CN.json

2026-06-03 09:09:49,130 [MainThread ] [ERROR] Template file not found: package/SKSE/Plugins/CommunityShaders/Translations/zh_CN.json
2026-06-03 09:09:49,142 [MainThread ] [ERROR] Template file not found: package/SKSE/Plugins/CommunityShaders/Translations/zh_CN.json
2026-06-03 09:09:49,149 [MainThread ] [ERROR] Template file not found: package/SKSE/Plugins/CommunityShaders/Translations/zh_CN.json
2026-06-03 09:09:49,190 [MainThread ] [ERROR] Failed to invoke function /usr/local/lib/python3.11/dist-packages/checkov/common/runners/object_runner. with package/SKSE/Plugins/CommunityShaders/Translations/zh_CN.json
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/checkov/common/parallelizer/parallel_runner.py", line 88, in func_wrapper
result = original_func(item)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/checkov/common/runners/object_runner.py", line 74, in
results = parallel_runner.run_

... [truncated 2989 characters] ...

rs/Translations/zh_CN.json
2026-06-03 09:09:49,260 [MainThread ] [ERROR] Exception traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/checkov/main.py", line 647, in run
self.scan_reports = runner_registry.run(
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/checkov/common/runners/runner_registry.py", line 177, in run
for result in parallel_runner_results:
File "/usr/local/lib/python3.11/dist-packages/checkov/common/parallelizer/parallel_runner.py", line 118, in _run_function_multiprocess_fork
raise v.internal_exception.with_traceback(v.internal_exception.traceback)
FileNotFoundError: [Errno 2] No such file or directory: 'package/SKSE/Plugins/CommunityShaders/Translations/zh_CN.json'

package/SKSE/Plugins/CommunityShaders/Translations/en.json

2026-06-03 09:09:49,127 [MainThread ] [ERROR] Template file not found: package/SKSE/Plugins/CommunityShaders/Translations/en.json
2026-06-03 09:09:49,135 [MainThread ] [ERROR] Template file not found: package/SKSE/Plugins/CommunityShaders/Translations/en.json
2026-06-03 09:09:49,147 [MainThread ] [ERROR] Template file not found: package/SKSE/Plugins/CommunityShaders/Translations/en.json
2026-06-03 09:09:49,191 [MainThread ] [ERROR] Failed to invoke function /usr/local/lib/python3.11/dist-packages/checkov/common/runners/object_runner. with package/SKSE/Plugins/CommunityShaders/Translations/en.json
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/checkov/common/parallelizer/parallel_runner.py", line 88, in func_wrapper
result = original_func(item)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/checkov/common/runners/object_runner.py", line 74, in
results = parallel_runner.run_function(lam

... [truncated 2962 characters] ...

yShaders/Translations/en.json
2026-06-03 09:09:49,259 [MainThread ] [ERROR] Exception traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/checkov/main.py", line 647, in run
self.scan_reports = runner_registry.run(
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/checkov/common/runners/runner_registry.py", line 177, in run
for result in parallel_runner_results:
File "/usr/local/lib/python3.11/dist-packages/checkov/common/parallelizer/parallel_runner.py", line 118, in _run_function_multiprocess_fork
raise v.internal_exception.with_traceback(v.internal_exception.traceback)
FileNotFoundError: [Errno 2] No such file or directory: 'package/SKSE/Plugins/CommunityShaders/Translations/en.json'


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

No actionable suggestions for changed features.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@tools/sort-i18n.py`:
- Around line 68-78: The check_order function currently strips "_meta" from
locale_keys, so files with "_meta" misplaced still pass; update check_order to
include "_meta" in locale_keys (i.e., do not filter it out) and construct
expected_keys to enforce "_meta" position: if "_meta" exists in data, prepend
"_meta" to expected_keys before adding en_key_order-filtered and extra_keys.
Modify the logic around en_key_order, expected_keys and locale_keys in
check_order to preserve insertion order from data and compare the full key
sequence (including "_meta") against the computed expected_keys.
🪄 Autofix (Beta)

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0613c3f5-6116-479a-87e7-64505ec4031b

📥 Commits

Reviewing files that changed from the base of the PR and between 6e82454 and f675e16.

📒 Files selected for processing (7)
  • .claude/CLAUDE.md
  • .github/workflows/pr-i18n.yaml
  • TRANSLATING.md
  • package/SKSE/Plugins/CommunityShaders/Translations/en.json
  • package/SKSE/Plugins/CommunityShaders/Translations/zh_CN.json
  • src/Features/ScreenSpaceGI.cpp
  • tools/sort-i18n.py

Comment thread tools/sort-i18n.py
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

✅ A pre-release build is available for this PR:
Download

@SkrubbySkrubInAShrub SkrubbySkrubInAShrub merged commit 8465329 into dev Jun 3, 2026
14 checks passed
@SkrubbySkrubInAShrub SkrubbySkrubInAShrub deleted the i18n-sort branch June 3, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants