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

Localize DateTimePicker Component #11938

Merged
merged 4 commits into from Nov 20, 2018

Conversation

Projects
None yet
4 participants
@georgeh
Contributor

georgeh commented Nov 15, 2018

Description

wp-date is deprecating its moment method, so we need to localize

Closes #4533 and #9109

How has this been tested?

Screenshots

Localized month and day (Esperanto
screen shot 2018-11-16 at 9 58 22 am
)

Week starts on Wednesday:
screen shot 2018-11-16 at 9 55 50 am

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
@georgeh

This comment has been minimized.

Contributor

georgeh commented Nov 16, 2018

@nosolosw and @jasmussen would you mind looking to see if the capitalization rules are correct in Español and Dansk? It's correct for English but I'm seeing lower-case where I'm not expecting it.

To test, check out the branch, set your language in wp-admin, then open the "Publish" date picker on a post. All the changes are in PHP so no rebuild is needed.

@georgeh georgeh requested a review from youknowriad Nov 16, 2018

@swissspidy

This comment has been minimized.

Member

swissspidy commented Nov 20, 2018

For core merge we might do something similar as with wp_localize_jquery_ui_datepicker()

@swissspidy swissspidy added the i18n label Nov 20, 2018

@nosolosw

This comment has been minimized.

Member

nosolosw commented Nov 20, 2018

In Spanish, Month and Day of Week are in lowercase, both in the settings page and the date picker.

Settings page:

If I choose "j M, Y" in the date format input, I see the textual three letters month in uppercase (eg: Nov), but the calendar still shows the full month.

date-format-es-f

Calendar

date-format-es-calendar

@nosolosw

This comment has been minimized.

Member

nosolosw commented Nov 20, 2018

Portuguese is uppercase:

Settings

date-format-pt

Calendar

date-format-pt-calendar

@nosolosw

This comment has been minimized.

Member

nosolosw commented Nov 20, 2018

I've checked and different apps have different ways to localize dates in Spanish: I get lowercase months in some and uppercase in others.

In case it's helpful, I've checked the Spanish translations in GlotPress (WordPress project) and they are consistent with what I saw in the settings page/calendar (lowercase for weekdays and whole months, uppercase for 3-letter months):

wordpress-translation-weekdays
wordpress-translation-months

@youknowriad

This does work for me in French and Arabic. I'd have preferred a fix in the data picker component instead of relying on moment being available as a global. That said it can be refactored later.

Would you mind rebasing and merging?

@georgeh georgeh force-pushed the fix/4533/localize-datepicker branch from 21e6166 to a947dbc Nov 20, 2018

@georgeh georgeh merged commit a61be20 into master Nov 20, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@georgeh georgeh deleted the fix/4533/localize-datepicker branch Nov 20, 2018

@youknowriad

This comment has been minimized.

Contributor

youknowriad commented Nov 20, 2018

This will be backported in Core during the packages updates.

grey-rsi pushed a commit to OnTheGoSystems/gutenberg that referenced this pull request Nov 22, 2018

Localize DateTimePicker Component (WordPress#11938)
* Add localizations to global moment

* Add day-of-week support

* Add date formats to moment

* Code Sniffer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment