Translate identity keys with sentence-case fallback - #138
Conversation
Identity keys without a translation were rendered raw (e.g.
"passport: 25HE94294" in a Spanish invoice). Keys are now looked up
in identity_labels across all locales, with a passport translation
added everywhere, and fall back to the key in sentence case
("internal-ref" becomes "Internal ref") so the missing-translation
marker never leaks into output. Locales that were missing the
identity_labels block entirely now include it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Locales are loaded with LoadWithDefault("en"), which merges English
entries into every locale without overwriting, so en is already the
single source for untranslated labels. Remove the it-fiscal-code and
de-tax-number lines duplicated across locales, keeping only genuine
translations (Arabic's it-fiscal-code and each locale's passport).
The test now loads locales the same way as goblhtml and verifies the
English fallback from Spanish.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Pushed a follow-up: |
Demonstrates the three identity label tiers: a locale translation (passport), the en fallback (it-fiscal-code), and the sentence-cased key for untranslated keys (internal-ref). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: methodofaction <51445+methodofaction@users.noreply.github.com>
Resolved by merging |
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: methodofaction <51445+methodofaction@users.noreply.github.com>
Resolved by merging |
What changed
passporttranslation toidentity_labelsin all 16 locales (e.g. "Pasaporte" in Spanish, as seen in the screenshot that prompted this).identity_labelsblock to the 10 locales that were missing it entirely (da, de, el, es, fr, it, nl, no, pl, pt) — this is whypassportfell through to the raw key even though the lookup existed.internal-ref→ "Internal ref" instead of the raw kebab-case key. The!(MISSING: ...)marker can never leak since the lookup result is only used when it lacks the!prefix.passport) and an untranslated one (internal-ref).Why
Follow-up to #137: identities with any key are now shown, but untranslated keys rendered raw, e.g. "passport: 25HE94294" on a Spanish invoice where "Pasaporte: 25HE94294" is expected.
Notes for reviewers
+since GOBL keys may contain sub-keys.🤖 Generated with Claude Code