feat: add complete Klingon localization - #2056
Conversation
|
@codex review — apply the review criteria in .gemini/styleguide.md in addition to AGENTS.md guidance |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Implementation Summary
|
|
Lol wow I tried codex on this one just to see what it would produce. It's so lazy it decided to defer to a "qualified translator." Incredible. |
8c421dc to
d66aa4b
Compare
Superseding implementation summaryThis comment supersedes the earlier partial-locale implementation summary. The locale is now complete; no HA/MCP translation work is deferred. Coverage
The selector label is Translation provenance
Grammar and semantic audit
Validation
|
3a7b784 to
ceb76d5
Compare
|
Post-#2055 rebase update — this supersedes my earlier implementation summaries; I am leaving those comments untouched.
The PR remains a draft while the fresh CI run completes. |
|
When reviewing this one keep in mind it's really more for fun. If this will add any kind of maintenance burden, footguns, or etc, or will make any other localization more difficult to handle then I will consider closing it. |
|
I'll add Esperanto too 😺 |
Patch76
left a comment
There was a problem hiding this comment.
The provenance section is what I would want every locale PR to carry: surveying the Foswiki, Blockly and humanize catalogs, rejecting the OpenOffice tree on a measured coverage figure, and running an explicit false-friend audit is a stronger sourcing story than the existing catalogs have behind them.
The branch is 12 commits behind master, and one of them changes what this PR has to satisfy. #2063 merged test_one_english_string_reads_the_same_on_every_surface, which compares every English string shipped from more than one surface against its translation on the others. The 31 green checks on ceb76d58 predate it.
Concern 1: I replicated that check against the catalogs at ceb76d58, and tlh diverges in 34 of the 53 shared groups — 46 values, 33 in homeassistant-addon-dev, 12 in homeassistant-addon, 1 in the component. The same run reports 0 for de, es, fr, ru and zh-Hans. It is the drift #2063 documents for de (25 groups) and zh-Hans (18): the settings UI and the add-on options word the same switch differently. The 34 groups cover 18 add-on options — among them enable_tool_search, tool_search_max_results, enable_tool_security_policies, read_only_mode, enable_mandatory_bps, enable_strict_mandatory_bps, the beta and YAML toggles and both snapshot-deletion fields — plus the component's extra_yaml_keys against the settings UI's extra_yaml_write_keys. All 34 have a settings UI member, so the tie-break the test names resolves every one of them: that is the wording the other surfaces follow.
Concern 2: test_tlh_catalog_loads_and_is_registered re-adds a per-locale copy of the kind #2055 replaced. Catalogs are discovered from the directory rather than registered, so the file test_every_locale_ships_on_every_surface already requires is what puts tlh in CATALOGS; test_shipped_catalog_loads_and_is_registered is parametrized over those and asserts native_name, dir, tool_groups and tools for tlh today. test_native_names_name_their_own_language pins the name's distinctness and test_agents_md_lists_every_shipped_locale the documentation line. An empty messages is caught by test_settings_catalog_is_not_a_copy_of_english, which counts a missing key as untranslated for exactly that reason. What the new test adds beyond all of those is three literal pins: the exact native_name, dir fixed to ltr rather than either direction, and actions.save. The docstring on the parametrized test gives the reason the four earlier copies were removed: they had drifted, ru had no copy at all and de asserted neither tool_groups nor tools.
Concern 3 is a scope question rather than a defect. tlh is not a Home Assistant language code: cv.language is vol.In(LANGUAGES) over homeassistant/generated/languages.py, which lists 64 codes and not this one, and the frontend's translationMetadata.json offers the same 64. The component catalog and both add-on catalogs — 177 of the 801 values — therefore have no path to being selected from the Home Assistant UI; only the settings UI carries its own picker. The four-surface rule requires shipping them either way, so the decision is whether a language Home Assistant itself cannot select should ship on the surfaces Home Assistant owns.
One minor point: the five existing catalogs use a bare endonym for meta.native_name, and this one appends an English gloss.
Unrelated to the above, #2062 edits the same AGENTS.md locale line, so whichever of the two lands second rebases it.
|
I will mark ready for review when I'm ready. Going to let the other language stuff merge first. |
|
After doing a simple docs PR that involved having the AI hand-edit multiple files, I definitely think we need to redo how our translations work before implementing this or any other fun languages. I'll file an issue a bit later about my thoughts/research (once session limit resets lol), but it seems like we can edit just English and then essentially have CI automatically generate changes to the other languages instead of having to hand edit. |
|
Yeah, this idea—which is great in theory—has turned into a bit of a nightmare. If something's missing here, something's missing there, and vice versa—it's kind of annoying, actually. |
|
See issue #2083 , I still need to properly research it but it should be the solution to our problems. |
What does this PR do?
Adds a complete Klingon (
tlh) localization across all four required surfaces:That is 799 translated values across the four catalogs. The language selector displays
tlhIngan Hol (Klingon). Every catalog section is populated; no HA/MCP prose is deliberately deferred to an English fallback. Product names, protocol names, paths, environment variables, tool identifiers, and other technical tokens remain unchanged where translating them would be incorrect.This branch is rebased onto the merged #2055 localization contract. The surrounding prose is Klingon, while references that must match fixed UI controls remain exact:
Local networkis the visible bind-host option andHA-MCP File & YAML Toolsis the created config-entry title. The Home Assistant action label corresponding to “Add entry” remains translated, matching the established locales.Translation provenance and QA
This went substantially beyond generating prose and checking that the JSON parsed:
-ghachnominalization flagged by the Klingon Corpus grammar rules, corrected noun plural classes, and reviewed formallu-/tI-verb-prefix agreement for plural objects.UNKNOWNgrammar diagnostics. The sole sentence grammatically adapted after feat: add the Spanish (es) locale across all four translated surfaces #2055's final merge was rechecked separately with the same result. RemainingUNKNOWNnotices are deliberate product, protocol, path, code, placeholder, and identifier tokens.tlhis covered by the merged documentation-parity assertion alongsidees.Type of change
Testing
uv run pytest)uv run ruff check)Current post-rebase local validation:
git diff --checkpytest -q tests/addon/test_addon_structure.py(14 passed)tlhIngan Hol (Klingon),ltr, andactions.save = polruff check tests/src/unit/test_settings_ui_i18n.pyruff format --check tests/src/unit/test_settings_ui_i18n.pyUNKNOWNgrammar diagnosticsceb76d58: 31 successful checks, 2 expected skips, 0 failuresThe bare Termux global Python environment does not contain the project's Starlette or FastMCP runtime dependencies, so the focused settings-UI pytest file and normal pytest collection of
test_locale_parity.pyare left to GitHub CI. No dependencies were installed solely to reproduce CI locally.Checklist