-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
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
jorg-vr
requested review from
bmesuere and
chvp
and removed request for
a team
January 18, 2024 14:56
bmesuere
approved these changes
Jan 18, 2024
chvp
reviewed
Jan 23, 2024
chvp
approved these changes
Jan 24, 2024
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.
This pull request removes the
I18n
object from the global scope.Instead the
i18n
object can be imported fromi18n/i18n
.It also introduces the
DodonaElement
as a new meta webcomponent used to inherit from.This component is a combination of the
ShadowlessLitElement
, theStateController
and thei18nMixin
.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 thei18nMixin
which might result in untranslated elements on the page.I also made some minor changes in the
I18n
class to fix typing issues:locale
toloc
aslocale
is defined as a function inPolyglot
, which we extend.super.warn
, as this is a private function inPolyglot
. I instead directly called thewarning
method they used directly.