Skip to content
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

Web components: Embed translations #566

Merged
merged 5 commits into from
Aug 24, 2023
Merged

Web components: Embed translations #566

merged 5 commits into from
Aug 24, 2023

Conversation

tkohr
Copy link
Collaborator

@tkohr tkohr commented Aug 4, 2023

PR adds a EmbeddedTranslateLoader that allows to embed translations in the built js and uses this loader for web components. This prevents the need to ship translation files along with the web component script. For now, it increases the gn-wc.js for about 14 kb per language. At a total size of 4 mb this change seems acceptable to me. Improvements might be made here when we optimize the web component's total bundling size (maybe by including only used translations or lazy loading).

TODO:

  • add some doc about web components

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

Affected libs: util-i18n, feature-catalog, feature-search, feature-record, feature-router, feature-map, feature-dataviz, feature-editor, feature-auth, ui-elements, ui-catalog, ui-search, ui-dataviz, ui-inputs, data-access-datafeeder, api-metadata-converter, util-data-fetcher, data-access-gn4, util-app-config, util-shared, ui-widgets, ui-map, util-types, ui-layout,
Affected apps: webcomponents, metadata-converter, metadata-editor, datahub, demo, search, map-viewer, datafeeder, data-platform,

  • 🚀 Build and deploy storybook and demo on GitHub Pages
  • 📦 Build and push affected docker images

@tkohr tkohr marked this pull request as ready for review August 4, 2023 15:59
@coveralls
Copy link

coveralls commented Aug 4, 2023

Coverage Status

coverage: 84.075% (+0.3%) from 83.772% when pulling 37692ec on web-components-i18n into 92fe7d2 on main.

Copy link
Collaborator

@jahow jahow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work, clean and simple! I've added a comment to make sure that we don't burden the bundles other than the web component one, but nothing else to add. And kudos for adding so much doc on the web components!!

I'm approving the PR so that you can merge whenever you're done. Thanks 🙂

libs/util/i18n/src/lib/i18n.constants.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@jahow jahow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Angi-Kinas, all good!

@Angi-Kinas Angi-Kinas merged commit eb14a2c into main Aug 24, 2023
5 checks passed
@Angi-Kinas Angi-Kinas deleted the web-components-i18n branch August 24, 2023 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants