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

Question: locale property may need to be removed #2321

Closed
driskull opened this issue Jun 16, 2021 · 3 comments
Closed

Question: locale property may need to be removed #2321

driskull opened this issue Jun 16, 2021 · 3 comments
Labels
i18n-l10n issues dealing with internationalization/localization
Milestone

Comments

@driskull
Copy link
Member

driskull commented Jun 16, 2021

Question

Should we have components with a locale property? (date-picker, input-date-picker, input)

Helpful Details

We have a few components using a locale property for specifying the locale to use for the component.

However, there's already a global attribute to handle this. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/lang#syntax

Currently, the default for the locale prop is set to use the document's lang or "en". like so:

/** BCP 47 language tag for desired language and country format */
  @Prop() locale?: string = document.documentElement.lang || "en";

However, it should probably just use the lang on the host and if not specified, it should fallback to use any element.closest('[lang]').lang and maybe even fallback to navigator.language if not set on the HTML. See https://developer.mozilla.org/en-US/docs/Web/API/NavigatorLanguage/language

Does this sound correct?

cc @eriklharper

@driskull driskull added question 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Jun 16, 2021
@eriklharper
Copy link
Contributor

I agree. This is quite similar to the page theme. It is basically a global that all our components should be aware of.

@jcfranco
Copy link
Member

This makes sense. We can deprecate locale props and remove prior to 1.0.0 since it wouldn't affect the behavior.

@jcfranco jcfranco added help wanted Issues that the core team needs help with in a sprint. and removed needs triage Planning workflow - pending design/dev review. labels Jun 21, 2021
@jcfranco jcfranco added this to the Sprint 7/19 – 7/30 milestone Jun 21, 2021
@julio8a julio8a added the i18n-l10n issues dealing with internationalization/localization label Jul 29, 2021
@eriklharper eriklharper removed 0 - new New issues that need assignment. help wanted Issues that the core team needs help with in a sprint. labels Feb 2, 2022
@eriklharper
Copy link
Contributor

Fixed by #3354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n-l10n issues dealing with internationalization/localization
Projects
None yet
Development

No branches or pull requests

4 participants