build(t9n): generate json file containing t9n values#7214
Conversation
| const t9nPath = resolve(assetsPaths, component, "t9n"); | ||
| if (existsSync(t9nPath)) { | ||
| data[component] = {}; | ||
| // the english file is the only one without the lang in the filename |
There was a problem hiding this comment.
English does have a corresponding bundle (see https://github.com/Esri/calcite-components/blob/master/packages/calcite-components/src/components/action/assets/action/t9n/messages_en.json). The one without a language code is the main one.
Could you update the regex pattern to match bundles with or without a language code?
There was a problem hiding this comment.
Oh gotcha. What should I be doing with the main one then, does it need to be included? And if so what should I call the key, "main"? cc @macandcheese
There was a problem hiding this comment.
It seems like messages.json and messages_en.json are always the same, but I created a separate field called main for messages.json anyway.
There was a problem hiding this comment.
Yeah, in most cases they will be the same. WDYT about omitting main for now until we have a strong reason to include it? Sorry, this would mean reverting the regex update I suggested earlier. 😅
| "scripts": { | ||
| "build": "npm run util:prep-build-reqs && stencil build", | ||
| "postbuild": "npm run util:patch && git restore src/components/*/readme.md", | ||
| "postbuild": "npm run util:patch && npm run util:generate-t9n-docs-json && git restore src/components/*/readme.md || true", |
There was a problem hiding this comment.
Is util:generate-t9n-docs-json throwing unnecessarily or is there another reason for the fallback true?
There was a problem hiding this comment.
Woops that was left over from my local testing. The docker container I use isn't a git repo so git restore fails. This is my workaround but I forgot to change it back, fixing!
…nches--master * origin/master: build(t9n): generate json file containing t9n values (#7214) chore: release next fix(combobox, dropdown, input-date-picker, input-time-picker, popover, tooltip): Prevent repositioning from affecting other floating components (#7178) build: update browserslist db (#7192) build: ignore node_modules and build outputs when watching for changes during stencil tests (#7209)
…issue-template-checkbox * origin/master: (32 commits) ci: double build cc when publishing to workaround stencil types bug (#7227) build: bump package versions back to 1.5.0-next.5 (#7228) chore: release latest (#7144) ci: hardcode release version due to reverting feat (#7225) fix(tree-item): ensure expanded tree-item is displayed when expanded and made visible (#7216) ci(release-please): pin action version and allow manually running action (#7222) fix(input, input-number): allows numeric characters. (#7213) build(t9n): generate json file containing t9n values (#7214) chore: release next fix(combobox, dropdown, input-date-picker, input-time-picker, popover, tooltip): Prevent repositioning from affecting other floating components (#7178) build: update browserslist db (#7192) build: ignore node_modules and build outputs when watching for changes during stencil tests (#7209) test: set up `disabled` helper to run a test per use case (#7089) ci: set design complete label conditionals (#7206) chore: release next fix(list): update selectedItems property on all item selection changes (#7204) chore: fix sorting logic for t9nmanifest entries (#7203) fix(radio-button): focuses first focusable radio-button element in group. (#7152) chore: release next fix(alert): update alert queue when an alert is removed from the DOM (#7189) ...
Related Issue: #6143
Summary
Generates
dist/extras/translations-json.jsonwhich contains the t9n values per component in the following format:{ "components": { "calcite-action": { "loading": { "en": "Close", "es": "Cerrar" // ... }, "disabled": { "en": "Close", "es": "Cerrar" // ... } }, "calcite-alert": { "loading": { "en": "Close", "es": "Cerrar" // ... }, "disabled": { "en": "Close", "es": "Cerrar" // ... } } } }