Repository navigation
feat(metals): render Metals v0.1.1 labels from translation.json (#331) - #342
Merged
Merged
Conversation
The stylesheet printed every label as fixed English text and the renderer
never loaded Metals' singular translation.json, so German labels such as
"Gussnummer" never reached the PDF.
- loader: JSON_TRANSLATIONS_FILE_NAME_PATTERN broadened to
translation*.json (as WatermarkManager already did, which now uses the
pattern as given); the file is not renamed
- TranslationLoader makes keys legal XML names (XmlKeySanitizer, ported
from material-identity/schema :legacy): Metals' translation.json has enum
keys such as "1/4T" that otherwise break the JSON -> XML step. Every
other family's keys are already legal and pass through unchanged
- stylesheet: mi:label(key, fallback) reads Root/Translations and falls
back to today's literal; 99 static lookups plus production identifier
types, tolerance rows and Order/Delivery/Contract. Every key's EN value
equals its fallback, so EN-only certificates render text-identically
(all 15 EN-only fixtures and both Interfer certificates diffed against
a render from main: identical)
- the header region grows by 0.7cm only when a certificate lists more
than one language, so the joined title no longer overlaps the body
- translation.json: 35 label keys added to EN and DE (EN = fallback);
existing EN wording untouched
- re-baselined the 14 v0.1.1 fixture PDFs that list DE: their labels now
read "EN / DE" (or German only). A token-level check shows no value
changed; bilingual pages may run onto a second page
- new fixture valid_bilingual_labels (EN+DE, "Cast Number / Gussnummer")
- test/metals-labels.spec.js: every looked-up key exists in EN and DE and
its EN value equals the stylesheet fallback; TranslationLoaderTest
covers loading, joining, sanitizing and the unchanged watermark text
Values, enum rendering (CastingMethod raw), Yes/No and in-value wording
("min.", "per", "Width" in the shape line) are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fourteen Metals v0.1.1 fixtures listed DE although nothing ever rendered it, so #331 turned their labels bilingual. Half of them, picked at random, go back to Languages ["EN"] and keep their pre-#331 reference PDFs byte for byte: country_of_melt_and_pour, individual_statements, mechanical_properties, regulatory_markings, result_types, statement_links, supplementary_tests. Bilingual coverage stays with the other six EN+DE fixtures, the DE-only physical_properties fixture and valid_bilingual_labels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rderId (material-identity/schema#426) The Metals v0.1.1 certificate dropped both fields silently. They now print on the grey detail line under the Order and Delivery rows, labelled through mi:label (EN "Customer Product Name" / "Internal Order ID", DE from translation.json), and only when present: a certificate without them renders exactly as before (Interfer 30/30 and Everest 37/37 unchanged). Re-baselines the 19 Metals v0.1.1 fixtures that carry InternalOrderId (text diff is additions only, plus one note moving across a page break in product_shapes and word_wrap_breaks). valid_extruded_aluminium_profile gains a CustomerProductName so both fields are covered. Builds on the #331 translated-labels branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…key collides (#331) XmlKeySanitizer let the first key take a contested name, so "a b" before "a_b" took a_b and the stylesheet would read the wrong value. Keys that are already legal XML names now own their name; a rewritten key moves aside with a "_" prefix. Key order is preserved. The test asserts the values, not just that both names exist. No translation file has such a pair today (review finding on #342). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s-order-fields-426
…non-empty (material-identity/schema#426) The guards tested for the element only, so "InternalOrderId": "" printed "Internal Order ID: " with nothing after it. normalize-space() also skips whitespace-only values. No fixture changes: every committed fixture carries non-empty values (review finding on #343). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Why would Interfer case be different here? They are also using Language property in the certificates |
asamark
approved these changes
Oct 5, 2026
asamark
left a comment
Collaborator
There was a problem hiding this comment.
I don't see any change specific to Interfer, I assume they will always use the fallback case. Just the github issue mentioned them
Member
Author
Yes, the have been there all the time. However, the translations have never been applied. All the Interfer examples in https://github.com/material-identity/schema/tree/main/customers/Interfer render without any difference. |
…ds-426 feat(metals): render Order.CustomerProductName and Delivery.InternalOrderId (schema#426)
stiebitzhofer
requested review from
asamark and
eamon0989
and removed request for
asamark and
eamon0989
October 5, 2026 11:08
asamark
approved these changes
Oct 6, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #331.
What
Metals v0.1.1 certificate labels now come from
translation.json. When a certificate listsDE, labels are joined as "Cast Number / Gussnummer"; an English-only certificate renders text-identically to before.mi:label(key, fallback), used for 99 fixed labels plus three data-driven lookups (production identifier types, tolerance rows, Order/Delivery/Contract). The fallback is today's English literal. Noxsl:import.translation*.json(SchemaControllerConstants);WatermarkManagernow uses it as-is. The file is not renamed.1/4TandQuenching and Temperingmade rendering fail ("Failed to parse XML securely").XmlKeySanitizeris ported from material-identity/schema and applied inTranslationLoader. Other families' keys are already legal and pass through unchanged (covered by a test).translation.json: 35 keys added to EN and DE; no existing EN wording changed.Fixtures
valid_bilingual_labels(EN+DE).DEalthough nothing rendered it. 7 of them, picked at random, are set back to["EN"]and keep their pre-change PDFs byte for byte. The other 7 (basic_certificate,dimensional_tolerances,product_analysis,product_shapes,production_identifiers,word_wrap_breaks, DE-onlyphysical_properties) are re-baselined. A word diff shows only added German label text and " / ".Gates
json2pdf.js --xsltPath, main vs branchjest test/metals-labels.spec.js(every key in EN and DE; EN equals fallback)npx jestmvn test -Dtest=RenderTest,TranslationLoaderTestMirror PR in material-identity/schema follows (byte-identical
Metals/v0.1.1; InterfercompareCustomer30/0, Everest 37/0).Please review
de.yamlwhere possible; no domain or print review yet).Average,Parameter,Statusare also schema property names, so the editor will show German labels for them.🤖 Generated with Claude Code