Make Ukrainian locale name follow ISO 639, update it and add tests#957
Make Ukrainian locale name follow ISO 639, update it and add tests#957nykula wants to merge 2 commits into
Conversation
|
|
||
| d = pendulum.now().subtract(weeks=2) | ||
| assert d.diff_for_humans(locale=locale) == "2 тижні тому" | ||
|
|
There was a problem hiding this comment.
d = pendulum.now().subtract(weeks=5)
assert d.diff_for_humans(locale=locale) == "5 тижнів тому"
There was a problem hiding this comment.
weeks=5 behaves in the same way as months=1, resulting in 1 місяць тому. Should I add that assertion?
There was a problem hiding this comment.
All locales behave the same in this regard. @afastronomer most likely meant that from the grammar point of view, 2 weeks and 5 weeks correspond to different forms in Ukrainian. But the latter form is currently unused in Pendulum; there's no feature, that I know of, to get a human representation of a duration in a specific unit such as weeks. One way to get to the form is:
pendulum.locale('uk').translation(f"units.week.{pendulum.locale('uk').plural(5)}").format(5)
# -> '5 тижнів'| lower = locale.lower() | ||
| if lower == 'ua': | ||
| # Backward compatibility. Ukrainian was 'ua' initially. | ||
| lower = 'uk' | ||
| return lower |
There was a problem hiding this comment.
Don't think we need that, since the initial locale had the wrong code. @ashb what do you think?
There was a problem hiding this comment.
So, do I remove this backward-compatibility part or keep it? I'm fine with either decision.
Pull Request Check List
Fixes #955.