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

i18n: Correctly expand fields in 'format_skeleton' #6293

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tomasr8
Copy link
Member

@tomasr8 tomasr8 commented Apr 12, 2024

Originally came up here: https://talk.getindico.io/t/japanese-ja-translation-group/542/18

The current behaviour of _adjust_skeleton produces incorrect date formatting for Japanese. This fixes the function to only perform allowed expansions.

More on this: https://cldr-smoke.unicode.org/spec/main/ldml/tr35-dates.html#Matching_Skeletons

Here's the effect this has on the meeting page (event/XXX):

Locale meeting page before meeting page after
de Montag, 20. November Mo., 20. November
en_CA Monday, November 20 Mon, November 20
en_GB Monday, 20 November Mon, 20 November
en_US Monday, November 20 Mon, November 20
es lunes, 20 de noviembre lun, 20 de noviembre
fr lundi 20 novembre lun. 20 novembre
it lunedì 20 novembre lun 20 novembre
pl poniedziałek, 20 listopada pon., 20 listopada
pt_BR segunda-feira, 20 de novembro seg., 20 de novembro
tr 20 Kasım Pazartesi 20 Kasım Pzt
cs pondělí 20. listopadu po 20. listopadu
uk понеділок, 20 листопада пн, 20 листопада
ja 11月月20日月曜日 11月20日月曜日

The week overview page (category/XXX/overview?period=week) doesn't change except for displaying correctly in Japanese
11月月20日月曜日 -> 11月20日月曜日

FWIW, more recent versions of CLDR do have a specific skeleton for EEEEdMMMM so we'll be able to get the full week day once babel updates.

It is not allowed to expand numeric fields into alpabetic ones
and vice versa. This fixes incorrect date formatting when using
the Japanese locale.
@tomasr8 tomasr8 changed the title i18n: Correctly expand fields 'format_skeleton' i18n: Correctly expand fields in 'format_skeleton' Apr 12, 2024
@ThiefMaster
Copy link
Member

I just tested with babel==2.15.0 which uses CLDR 44, but on de_DE I still get Mo., 9. Juli when using format_skeleton('EEEEdMMMM'). I also tried using the native Babel format_skeleton instead of our custom logic and get the same behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants