TEDEFO-5133: Select preferred language only when translating view templates - #170
Merged
rousso merged 1 commit intoAug 5, 2026
Merged
Conversation
rouschr
approved these changes
Aug 5, 2026
rousso
deleted the
TEDEFO-5133-efx1-preferred-language-outside-templates
branch
August 5, 2026 13:34
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.
Problem
EFX-1 wrapped every read of a
text-multilingualfield value inefx:preferred-language-text(...), regardless of what was being translated. That function is defined only in the notice viewer's XSL, so any Schematron rule or standalone expression that read a multilingual value produced output that cannot execute.Nothing warns the author.
BT-500-Organization-Company is not presentis fine, whileis emptyon the same field silently emits the broken call — the two are one word apart.No shipped SDK artefact is affected today: all 38 rule conditions in
fields.jsonthat reference multilingual fields use presence tests, which never read a value.Change
The preferred language is now selected only when translating view templates.
XPathScriptGeneratorV1no longer overridescomposeFieldValueReference. The@languageIDguard moved to an override ofgetTextInPreferredLanguage, keeping the XPath-specific logic in the XPath generator.EfxTemplateTranslatorV1gained a privatecomposeFieldValueReference(PathExpression)— the single place where multilingual fields are handled — used by the$valueshorthand, the#{...}label shorthand and the two field reference overrides.exitScalarFromFieldReferenceandexitSequenceFromFieldReferencecheckstack.peekType()and delegate straight to the parent unless the field is multilingual, so attribute handling stays where it was.EfxExpressionTranslatorV1is unmodified. No interface changes. V2 is untouched.Tests
The three template characterisation tests were written and run against unmodified code before any production change, and pass unchanged afterwards. A fourth, covering a multilingual field used as a sequence, was added later and verified the same way against
origin/develop.The V1 expression tests that asserted the wrapper now assert its absence, and a sequence case was added.
EfxTestsBaseno longer registers theefx:extension functions with Saxon. With the namespace declared but nothing registered, an expression that calls one fails to compile, soassertValidXPath()now enforces the boundary on its own.Full suite: 1340 tests, 0 failures.