Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
Closed as duplicate of#126727
Description
Bug report
It is broken in the same way aslocale.nl_langinfo(locale.ALT_DIGITS)
was broken (see#124969), although not to the same degree. It returns the last (current) era.
importlocale,subprocessalllocales=subprocess.check_output(['locale','-a']).decode().split()forlocinalllocales:if'.'inlocor'@'inloc:continuetry:_=locale.setlocale(locale.LC_ALL,loc)exceptlocale.Error:continueera=locale.nl_langinfo(locale.ERA)ifera:print(loc,era)
Output:
cmn_TW +:2:1913/01/01:+*:民國:%EC%Ey年hak_TW +:2:1913/01/01:+*:民國:%EC%Ey年ja_JP +:2:2020/01/01:+*:令和:%EC%Ey年japanese +:2:2020/01/01:+*:令和:%EC%Ey年lo_LA +:1:-543/01/01:+*:ພ.ສ.:%EC %Eylzh_TW +:2:1913/01/01:+*:民國:%EC%Ey年nan_TW +:2:1913/01/01:+*:民國:%EC%Ey年thai +:1:-543/01/01:+*:พ.ศ.:%EC %Eyth_TH +:1:-543/01/01:+*:พ.ศ.:%EC %Eyzh_TW +:2:1913/01/01:+*:民國:%EC%Ey年
The result is not completely useless, as it can be used to format and parse the current dates. But dates before the start of the current era (it is 2020 in Japan) cannot be proceeded.
The result should be a tuple, containing information for all eras, but this is a breaking change. So, perhaps such change cannot be backported.
cc@methane
Metadata
Metadata
Assignees
Labels
Projects
Status
Done