Skip to content

Translate identity keys with sentence-case fallback - #138

Merged
methodofaction merged 5 commits into
mainfrom
identity-key-labels
Aug 11, 2026
Merged

Translate identity keys with sentence-case fallback#138
methodofaction merged 5 commits into
mainfrom
identity-key-labels

Conversation

@methodofaction

Copy link
Copy Markdown
Contributor

What changed

  • Added a passport translation to identity_labels in all 16 locales (e.g. "Pasaporte" in Spanish, as seen in the screenshot that prompted this).
  • Added the identity_labels block to the 10 locales that were missing it entirely (da, de, el, es, fr, it, nl, no, pl, pt) — this is why passport fell through to the raw key even though the lookup existed.
  • When a key has no translation, the label now falls back to the key in sentence case: 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.
  • Added a regression test rendering a Spanish party with a translated key (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

  • Sentence-casing also splits on + since GOBL keys may contain sub-keys.
  • No example outputs changed (no example uses a key-only party identity).

🤖 Generated with Claude Code

methodofaction and others added 2 commits August 6, 2026 12:58
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>
@methodofaction

Copy link
Copy Markdown
Contributor Author

Pushed a follow-up: it-fiscal-code and de-tax-number are no longer duplicated across locales. Locales are loaded with LoadWithDefault("en") (see goblhtml.go), which merges English entries into every locale without overwriting, so en/app.yml is the single source for untranslated labels. Only genuine translations remain in other locales (Arabic's it-fiscal-code, each locale's passport). The test now loads locales exactly like production and asserts the en fallback from Spanish.

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>
@pedrorfdez
pedrorfdez self-requested a review August 6, 2026 12:22
@methodofaction

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: methodofaction <51445+methodofaction@users.noreply.github.com>

Copilot AI commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved by merging origin/main into this branch and fixing the conflict in components/org/party_templ.go in commit 4321f33.

@methodofaction

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: methodofaction <51445+methodofaction@users.noreply.github.com>

Copilot AI commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved by merging origin/main and fixing conflicts in components/org/party_templ.go and examples/index.html in commit 5190a26.

@methodofaction
methodofaction merged commit ce2f5fb into main Aug 11, 2026
@methodofaction
methodofaction deleted the identity-key-labels branch August 11, 2026 15:07
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.

3 participants