fix(harmonia): print data in the chosen print language, not the UI locale (#6945) - #6946
Open
NicoleNG18 wants to merge 1 commit into
Open
Conversation
…cale (eclipse-dirigible#6945) The Harmonia document/manage Print flow picked the template folder by the chosen print language (labels came out correctly) but fetched the print data from the generated PrintFeeder with the UI locale as Accept-Language. Since the generated repositories overlay multilingual values from Accept-Language, the nomenclature VALUES (Payment Method, Sent Method, Status, ...) rendered in the UI locale while the template rendered in the print language - the two halves of the document disagreed. Pin the feeder GET's Accept-Language to the chosen print language so the multilingual overlay resolves data in the same language as the template: - api.js: request() honors an opt-in { language } per-call override; absent it, the Region & Language store applies as before. - document-page / form-page print feeder fetch passes { language: lang }. Also refresh the engine-document guide, which still described the pre-feeder "client supplies the data" design. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Fixes #6945.
Printing a document (or a record from the manage form) in a language different from the current UI language produced a PDF whose labels were in the chosen print language but whose nomenclature values (Payment Method, Sent Method, Status, ...) were in the UI locale. The two halves of the document disagreed — e.g. a Bulgarian Sales Invoice template (ФАКТУРА, ПАДЕЖ) still reading "E-mail" / "Bank transfer" / "SENT".
Root cause
The Harmonia Print flow has two language selectors that were not kept in sync:
langis passed asPOST /services/print/{entity}?lang=bg, which selects the CMS template folderTemplates/<Entity>/Print/bg/. ✅{document, items}payload is fetched from the generated…PrintFeeder/{id}endpoint first. The feeder loads each related nomenclature through its generated repository, which overlays translations viaTranslatorusingUser.getLanguage()→ the request'sAccept-Languageheader.The feeder is fetched through the shared
App.services.api.get(...), which always setsAccept-Languageto the UI locale store (codbex.harmonia.language), never the print-dialoglang. So the data translated to the UI language while the template was in the print language.Fix
Pin the feeder GET's
Accept-Languageto the chosen print language, so the multilingual overlay resolves data in the same language as the template — using the mechanism the rest of the platform already uses.application-coreservices/api.js:request()honors an opt-in{ language }per-call override; absent it, the Region & Language store applies exactly as before (backward compatible).document-page.js.templateandform-page.js.template: the print feeder fetch passes{ language: lang }.engine-documentguide, which still described the pre-feeder "client supplies the data" design.Scope / notes
attach: print/reportinSend.java/Notification.java) calls the feeder in a background listener where there is no request-scopedAccept-Language; it selects the template language via an expression but the feeder data stays in the base language. That is the same bug class but a different (in-process, thread-local) fix and is intentionally out of scope here.Verification
Manual (no JS test harness): generate an app with a multilingual nomenclature and a
bgprint template, keep UI = English, print → Bulgarian; the nomenclature values now render in Bulgarian ("Банков превод", "Изпратена"). English-UI/English-print is byte-identical to before.Reminder:
api.jsis bundled into the fat jar — a locally running instance needsapplication-core+build/applicationrepackaged and a restart to reflect the change; target apps need regeneration to pick up the template edits.🤖 Generated with Claude Code