-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow for tree-shaking unused langauges translations in custom apps #19799
Draft
Platonn
wants to merge
13
commits into
epic/tew-translation
Choose a base branch
from
epic/tew-translation--script-v2
base: epic/tew-translation
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
…- to relative public_api.ts
…ame (chunk name) is in kebab-case, then convert the chunk name to camelCase (without changing the original JSON file)
…nch with latest translations
…ix>TranslationsEn` instead of the deprecated `<prefix>Translations` wrapper object
…slations-ts-barrels.config'
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.
index.ts
files to re-export JSON translations in TS for new langaugestranslations.ts
barrel files, to export each langauge in a separate public API members (to allow for treeshaking unused langauges). Note: it preservers the old feature prefix (e.g.asmTranslations
->asmTranslationsEn
,asmTranslationsDe
, ...)asmTranslations
(and moved those deprecated tokens topublic_api.ts
files fromtranslations.ts
files)asmTranslations
langauges other thanen
(in other words: revert the change made previously on the branch epic/tew-translation which added 3 other langauges into those wrapper objects)extractTranslationChunksConfig()
in@spartacus/core
and use it in every library for creating chunks config in theirtranslation.ts
files. It extracts the chunks config from the translations assets automatically. So no more need to type chunks config manually.By the way:
extractTranslationChunksConfig()
myAccountV2NotifiationPerference
, HOWEVER I didn't fix it in this PR - it should be done in a separate PRmy-account-v2-notification-perference.json
(btw. it's a different typo than the above chunk name), HOWEVER I didnt fix it in this PRThe reason I didn't want to fix those things by the way is:
TODO
related to https://jira.tools.sap/browse/CXSPA-9131
QA steps
npx @angular/cli@17 new test-app --standalone=false --ssr=false
ng add @spartacus/[email protected]. 0-1 --baseUrl="https://40.76.109. 9:9002" --ssr
AND PLEASE SELECT ALL possible features and integrations in the interactive promptresources:
and verify that everywhere in every feature module we use the new approach with explicit EN translationstranslations
wrapper object and verify it's@deprecated
(crossed out in VSCode)http-server
)ng build
(or for interactive mode runnpm run watch
). Don't tryng serve --configuration=production
- it doesn't have so well tree shaking asng build
npx http-server dist/test-app/browser
(or for interactive mode run in another terminalnpx nodemon --watch "./dist/test-app/browser" --exec "npx http-server './dist/$test-app/browser'" --ext "*"
ariaLabelSuggestions
and verify that in the loadedmain.js
file there are only 2 langauges (EN and DE which you have enabled in steps above) with translations for this key