Skip to content

ui: language command docs and error list every language - #1998

Merged
aiongg merged 1 commit into
storytold:mainfrom
webglobepl:language-option-lists
Oct 22, 2026
Merged

aiongg merged 1 commit into
storytold:mainfrom
webglobepl:language-option-lists

Conversation

@webglobepl

@webglobepl webglobepl commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

app.language.set takes 11 language codes, but the two places that list them were written by hand and had fallen behind:

Where Missing
engine.commands docs for app.language.set (control.rs) es, fr, sr
the unknown-language error (lib.rs) de, fr, sr

Changes

  • Language::code_list(separator) builds the quoted list from Language::ALL, and both places use it. A new language is listed automatically.
  • Tests: language_command_docs_list_every_language (control.rs) and an extra check in language_commands_switch_and_persist that the error for "xx" names every code.
  • docs/control-protocol.md mentions where the codes are listed.

Noticed by CodeRabbit on #1807 (Polish interface). That PR adds pl to both lists by hand. Whichever lands second drops that hand-written part, since Language::ALL will include Polish.

Tests

Locally on Windows: cargo fmt --check, cargo test -p gridcraft-ui-egui (all pass). cargo clippy -p gridcraft-ui-egui -D warnings stops only at the existing let_unit_value in desktop_theme.rs, which is on main and not touched here.

Summary by CodeRabbit

  • Documentation
    • Language-setting help and error messages now list all supported language codes, keeping available options consistent and up to date.

app.language.set's engine.commands docs and its unknown-language error
were written by hand and had fallen behind: the docs missed es, fr and
sr, the error missed de, fr and sr. Both are now built from
Language::ALL (Language::code_list), and tests check every language is
listed in each.
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b1d9a4a4-dc2b-4057-a86d-89933314ade8
📥 Commits

Reviewing files that changed from the base of the PR and between 49fe41a and 553b0bd.

📒 Files selected for processing: 4
  • crates/ui-egui/src/control.rs
  • crates/ui-egui/src/i18n.rs
  • crates/ui-egui/src/lib.rs
  • docs/control-protocol.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

📝 Walkthrough

The change adds Language::code_list to format supported language codes. Command discovery and the unknown-language error now use this generated list. Tests check the listed codes, and the control protocol documentation describes them.

Changes: Language code listings

Layer / File(s) Summary
Format supported language codes
crates/ui-egui/src/i18n.rs
Language::code_list formats every code in Language::ALL as a quoted value, joined by the supplied separator.
Use the supported code list
crates/ui-egui/src/control.rs, crates/ui-egui/src/i18n.rs, crates/ui-egui/src/lib.rs, docs/control-protocol.md
Command discovery and the unknown-language error use the generated codes. Tests check the command documentation and error message. The protocol documentation lists the supported codes.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: echelon, losminek

Merge Risk: ⚪ Minimal · up to 553b0

Supported language codes are presented consistently in command discovery, error messages, and protocol documentation. No actionable merge-blocking risk is evident.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: updating the language command documentation and error message to list every supported language.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@aiongg
aiongg merged commit b388aaa into storytold:main Oct 22, 2026
1 check passed
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