-
Notifications
You must be signed in to change notification settings - Fork 445
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
KeyError raised from format_time() with zh_TW on Babel 2.3.1 #378
Comments
Thanks for the awesome details! It really helped a lot. :) Anyhow, this was probably introduced with the day period API change. Prior to this change, it looks like So, for zh_TW, if we look at zh_Hant.xml's gregorian calendar settings, we can see why it broke:
However, I think the underlying problem is that the day period settings are not falling back to zh.xml, which does have am defined for both contexts.
I'm also still missing a piece of the puzzle -> dayPeriods.xml does not require am/pm for zh, so I'm not entirely sure why it's defined in zh.xml in the first place. I can pick this back up tomorrow, although I will not complain if someone else does before then. :) |
`zh_Hant` locale data does not have names for the `am` and `pm` day periods in the `format`/`abbreviated` context, so fallback logic is added to deal with that eventuality. Fixes python-babel#378
@jun66j5: Thanks for the bug report and sorry for the inconvenience 😞 However I think I have a fix for this in #379 😁 Just to verify though: @jtwang: I think one piece of the puzzle that you're missing with your sleuthing there (and thanks for the pointers btw! :) ) is that there's actually a parent chain exception for <!-- ✂️ -->
<parentLocale parent="root" locales="az_Arab az_Cyrl bm_Nkoo bs_Cyrl en_Dsrt en_Shaw ha_Arab iu_Latn mn_Mong ms_Arab pa_Arab shi_Latn sr_Latn uz_Arab uz_Cyrl vai_Latn zh_Hant"/>
<!-- ✂️ --> However I still think the <!-- ✂️ -->
<dayPeriodContext type="format">
<dayPeriodWidth type="abbreviated">
<dayPeriod type="midnight">午夜</dayPeriod>
<dayPeriod type="morning1">清晨</dayPeriod>
<dayPeriod type="morning2">上午</dayPeriod>
<dayPeriod type="afternoon1">中午</dayPeriod>
<dayPeriod type="afternoon2">下午</dayPeriod>
<dayPeriod type="evening1">晚上</dayPeriod>
<dayPeriod type="night1">凌晨</dayPeriod>
</dayPeriodWidth>
<dayPeriodWidth type="narrow">
<dayPeriod type="midnight">午夜</dayPeriod>
<dayPeriod type="am">上午</dayPeriod>
<dayPeriod type="pm">下午</dayPeriod>
<dayPeriod type="morning1">清晨</dayPeriod>
<dayPeriod type="morning2">上午</dayPeriod>
<dayPeriod type="afternoon1">中午</dayPeriod>
<dayPeriod type="afternoon2">下午</dayPeriod>
<dayPeriod type="evening1">晚上</dayPeriod>
<dayPeriod type="night1">凌晨</dayPeriod>
</dayPeriodWidth>
<dayPeriodWidth type="wide">
<dayPeriod type="midnight">午夜</dayPeriod>
<dayPeriod type="am">上午</dayPeriod>
<dayPeriod type="pm">下午</dayPeriod>
<dayPeriod type="morning1">清晨</dayPeriod>
<dayPeriod type="morning2">上午</dayPeriod>
<dayPeriod type="afternoon1">中午</dayPeriod>
<dayPeriod type="afternoon2">下午</dayPeriod>
<dayPeriod type="evening1">晚上</dayPeriod>
<dayPeriod type="night1">凌晨</dayPeriod>
</dayPeriodWidth>
</dayPeriodContext>
<!-- ✂️ --> |
Okay to me. However, I think it would be good to check with order of
According to http://unicode.org/cldr/trac/ticket/9017, that issue is fixed in CLDR Release 29. |
@jun66j5 That happens to be what the patch does in any case, so yay. :) Please hold for 2.3.2, to be released Very Soon Now :) |
`zh_Hant` locale data does not have names for the `am` and `pm` day periods in the `format`/`abbreviated` context, so fallback logic is added to deal with that eventuality. Fixes #378
(Originally, reported in https://trac.edgewall.org/ticket/12445)
This issue doesn't occur on Babel 2.2.0.
I guess that
format_period()
should passcontext='format'
toget_period_names()
.The text was updated successfully, but these errors were encountered: