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

Refactor i18n to not use global scope #5305

Merged
merged 11 commits into from
Jan 24, 2024
Merged

Refactor i18n to not use global scope #5305

merged 11 commits into from
Jan 24, 2024

Conversation

jorg-vr
Copy link
Contributor

@jorg-vr jorg-vr commented Jan 18, 2024

This pull request removes the I18n object from the global scope.
Instead the i18n object can be imported from i18n/i18n.

It also introduces the DodonaElement as a new meta webcomponent used to inherit from.
This component is a combination of the ShadowlessLitElement, the StateController and the i18nMixin.
A lot of custom components used at leased two of the three parts, so making a generic combined class made it easier to include all. I particularly introduced it in this pr because multiple web components used i18n without the i18nMixin which might result in untranslated elements on the page.

I also made some minor changes in the I18n class to fix typing issues:

  • I renamed the accessor locale to loc as locale is defined as a function in Polyglot, which we extend.
  • I removed the usage of super.warn, as this is a private function in Polyglot. I instead directly called the warning method they used directly.

@jorg-vr jorg-vr added the chore Repository/build/dependency maintenance label Jan 18, 2024
@jorg-vr jorg-vr self-assigned this Jan 18, 2024
@jorg-vr jorg-vr marked this pull request as ready for review January 18, 2024 14:56
@jorg-vr jorg-vr requested a review from a team as a code owner January 18, 2024 14:56
@jorg-vr jorg-vr requested review from bmesuere and chvp and removed request for a team January 18, 2024 14:56
@jorg-vr jorg-vr requested a review from chvp January 24, 2024 09:48
@jorg-vr jorg-vr merged commit 1d73031 into main Jan 24, 2024
12 of 13 checks passed
@jorg-vr jorg-vr deleted the feat/refactor-i18n branch January 24, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Repository/build/dependency maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants