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

Enhancement: l10n support for input-time-picker and time-picker components #1475

Closed
eriklharper opened this issue Jan 26, 2021 · 18 comments
Closed
Labels
4 - verified Issues that have been released and confirmed resolved. enhancement Issues tied to a new feature or request. i18n-l10n issues dealing with internationalization/localization p - high Issue should be addressed in the current milestone, impacts component or core functionality

Comments

@eriklharper
Copy link
Contributor

eriklharper commented Jan 26, 2021

Description

Adds locale-specific formatting to calcite-time-picker and calcite-input-time-picker based on Intl.DateTimeFormat.

Acceptance Criteria

Formats time appropriately based on locale in both the popup time-picker UI and in the corresponding input.

Relevant Info

Consult calcite-date for implementation details, which will be similar.

Which Component

calcite-time-picker, calcite-input-time-picker

Example Use Case

Resources

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat

@eriklharper eriklharper added enhancement Issues tied to a new feature or request. 0 - new New issues that need assignment. labels Jan 26, 2021
@eriklharper eriklharper self-assigned this Jan 26, 2021
@eriklharper eriklharper added the 1 - assigned Issues that are assigned to a sprint and a team member. label Jan 26, 2021
@julio8a julio8a removed the 0 - new New issues that need assignment. label Jan 28, 2021
@AdelheidF
Copy link

From Erik

It looks promising to see that the Intl.DateTimeFormat api supports locale formatting through this similar formatToParts API that I used to add number locale support https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts so it looks like we would do something quite similar for time formats as well. We would simply extract the time components based on the provided locale and arrange the components as appropriate in the UI.

@jcfranco jcfranco added this to the Sprint 7/5 – 7/16 milestone Jul 2, 2021
@jcfranco jcfranco added the p - high Issue should be addressed in the current milestone, impacts component or core functionality label Jul 2, 2021
@eriklharper eriklharper changed the title Enhancement: I18n support for time-picker Enhancement: I18n support for input-time-picker and time-picker components Jul 8, 2021
@eriklharper eriklharper added the i18n-l10n issues dealing with internationalization/localization label Jul 8, 2021
@eriklharper eriklharper changed the title Enhancement: I18n support for input-time-picker and time-picker components Enhancement: l10n support for input-time-picker and time-picker components Jul 8, 2021
@eriklharper eriklharper added l10n and removed i18n-l10n issues dealing with internationalization/localization labels Jul 8, 2021
@jcfranco jcfranco added i18n-l10n issues dealing with internationalization/localization and removed l10n labels Jul 9, 2021
@julio8a
Copy link

julio8a commented Jul 16, 2021

@babakbolour can you take a look at this one

@julio8a julio8a added 0 - new New issues that need assignment. and removed 1 - assigned Issues that are assigned to a sprint and a team member. labels Jul 16, 2021
@julio8a julio8a added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 0 - new New issues that need assignment. labels Jul 16, 2021
@babakbolour
Copy link

@julio8a ok. will have @raje9276 look at this and comment back.

@raje9276
Copy link

I18n Considerations

  1. 12hour vs 24 hour clock. In some locales default is 24 hour clock
  2. AM/PM should be translated in some locales
  3. AM/PM location may be after or before the time. Example: 10.00 PM can be written as 오후 10시
  4. Native numbers should be considered for Arabic.

@jcfranco jcfranco added this to the Sprint 01/03 - 01/14 milestone Jan 5, 2022
@eriklharper eriklharper added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels Jan 8, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2022

Installed and assigned for verification.

@github-actions github-actions bot assigned benelan and unassigned eriklharper Jan 8, 2022
@AdelheidF
Copy link

AdelheidF commented Jan 8, 2022

Currently the lang property has to be on the component itself for it to translate the am/pm strings. If this is intended then this prop is missing in the doc. But normally the lang prop works as long as a parent has it.
https://codepen.io/afreitag/pen/QWqrRGg

@AdelheidF
Copy link

AdelheidF commented Jan 12, 2022

From Erik:
it looks up to the document's lang or navigator.lang but it won't look up to any other parent nodes

@benelan
Copy link
Member

benelan commented Jan 26, 2022

Verified on next with the caveat Adelheid mentioned

it looks up to the document's lang or navigator.lang but it won't look up to any other parent nodes

We don't document global attributes, but do you think this should be mentioned somewhere due to the caveat? @jcfranco @macandcheese

@benelan benelan closed this as completed Jan 26, 2022
@benelan benelan added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Jan 26, 2022
@AdelheidF
Copy link

I tested all languages here:
https://codepen.io/afreitag/pen/MWOYOrp

Some don't seem to place the am/pm correctly. I don't know which version is right, but it should be the same between calcite-time-picker and calcite-input-time-picker.

image

image

@AdelheidF AdelheidF reopened this Jan 27, 2022
@AdelheidF AdelheidF added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 4 - verified Issues that have been released and confirmed resolved. labels Jan 27, 2022
@raje9276
Copy link

Calcite Input picker is the right format. AM/PM should be placed before the hour :minutes
CLDR Code


a h:mm

@AdelheidF
Copy link

AdelheidF commented Jan 27, 2022

To recap:

This issue here was about translating the time into different languages, e.g. am/pm. The main part of this is fixed now.

What's left here is that in LTR languages ZH and KO the am/pm is on the wrong side in calcite-time-picker.
calcite-input-time-picker does it correctly.

https://codepen.io/afreitag/pen/MWOYOrp

@eriklharper eriklharper added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 1 - assigned Issues that are assigned to a sprint and a team member. milestone adjusted labels Feb 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2022

Installed and assigned for verification.

@eriklharper
Copy link
Contributor Author

Closing this and we'll continue discussion of the issue in #3883.

@benelan benelan added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. enhancement Issues tied to a new feature or request. i18n-l10n issues dealing with internationalization/localization p - high Issue should be addressed in the current milestone, impacts component or core functionality
Projects
None yet
Development

No branches or pull requests

7 participants