Move shared translations into Shared WebApp#871
Merged
Conversation
1a4d7b3 to
877c83d
Compare
|
877c83d to
278463a
Compare
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.



Centralize shared-webapp/ui translations into a single Lingui catalog
Summary & Motivation
Each self-contained system (account, main, back-office) used to extract translatable strings from both its own source AND
application/shared-webapp/ui/**/*.{ts,tsx}into its own.pofiles. Every shared<Trans>ended up duplicated across three catalogs — a Danish translation for a shared<Trans>Save</Trans>had to be maintained in three places, and re-extractions across systems would drift out of sync.This change gives
shared-webapp/uiits own Lingui catalog and merges catalogs at runtime so each shared string is translated once.application/shared-webapp/ui/lingui.config.tsrooted atshared-webapp/ui/translations/locale/{locale}and scanning onlyshared-webapp/ui/**/*.{ts,tsx}.update-translationsscript toapplication/shared-webapp/ui/package.json.shared-webapp/uiglob fromcreateLinguiConfig()so each system extracts only its own strings.createFederatedTranslationto dynamic-import the shared catalog alongside the host's own and merge messages with precedence shared < own < federated remote.account/da-DK.pointo the new sharedda-DK.po. The remaining 2 strings (Loading,Open calendar) had no prior Danish translation.Build pipeline fix
A long-standing turbo cache issue caused the frontend build to hit the cache and skip
lingui extract, leaving.pofiles stale until manually invalidated. Wireupdate-translationsas an uncached turbo task thatbuilddepends on, and removeupdate-translationsfrom each WebApp's npmbuildscript chain so turbo invokes it via the dep.Federation context fix in PreviewAvatarMenu
The
Languagesubmenu under the avatar on the/componentspage rendered with zero items becauseuse(translationContext)returned the default value (locales: []). Each federated module bundles its own copy of@repo/ui(wheretranslationContextis defined viacreateContext), so the host's context provider does not propagate across the federation boundary. Readlocalesdirectly fromi18n.config.jsoninstead, matching the workaround already used inusePreferences.tsx. Locale changes still route correctly via the document-levellocale-change-requestevent.Documentation
Update
.claude/rules/frontend/translations.md— items 6 and 7 reflect the split catalog architecture and the uncachedupdate-translationstask. All other items and examples are preserved verbatim.Checklist