-
Notifications
You must be signed in to change notification settings - Fork 156
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
Integrate with Intl Era and Month Codes proposal #526
Comments
In general, this comes up on the ECMA-402 side of Temporal, where the non-ISO calendars are specified. This comes up for Intl more broadly, e.g., for some future extension of Intl.DisplayNames. For Stage 3, I think it's fine for us to have vague text about the names. This is an action item for the ECMA-402 WG to come to a conclusion on, and should be part of the Stage 4 final integrated spec text. |
How about designing the |
Meiji is the first era in Modern Japan. One idea therefore would be to adopt a scheme such as:
Eras prior to Meiji can be inserted in descending order, like:
I intentionally left one extra digit at the end in case eras need to be added in the future. I'm told that as we get far back into Japanese history, eras are sometimes still being discovered. |
Is there any official Japanese institution that handles this issue ? The Temporal team could then take into account the way they "code" the eras, if they do so. And how they do if they discover new eras in the past. |
So I and @sffc have been discussing some options and tradeoffs, and we want to eventually present them, but first I wanted a quick temperature check: How do people feel about just using Kanji for the era names? It's guaranteed to be unique, and ultimately these are identifiers so people can copy-paste them. The downsides are:
Mostly looking to see if people think this is a good idea, if they think it's a good idea but have some reservations (which we can weigh when we look at the tradeoffs), or if they think it's a really bad idea and should be excluded from consideration. |
When we are talking about programmatic identifiers (not user strings), as limiting as it is, ASCII alphanums have the advantage of :
|
I don't think it's a bad idea but I also don't think pushing developers out of an ASCII / C-locale / Gregorian bubble is a design goal of Temporal. Rather, it's a goal to make doing the right thing the easiest course of action. I don't see this significantly contributing in that way. |
@ptomato yeah the primary goal of that proposal is that it avoids a bunch of other tradeoffs due to the ascii requiring disambiguators. It does seem like it's worth talking about, though perhaps may not be the winner when we weigh all the other tradeoffs against each other |
If names are problematic, I don't see a problem with a scheme like @sffc described above in #526 (comment). A hybrid approach could be pairing a numeric code with a transliterated string, e.g. 10001_meiji, 10002_taisho, etc. Even if the word part is duplicated, the number could disambiguate. Keep in mind that these strings are never supposed to be shown to end users, so IMHO it really doesn't matter what they are as long as they can be read and copy/pasted easily. I'd strongly suggest sticking to ASCII for the reasons noted above. In particular, using Kanji seems fraught with potential problems because a lot of localized software development and debugging happens by developers who aren't fluent in the language being used. Using characters that are not readable by the developers writing the code seems like a bad idea. |
Yes, there are other options with different tradeoffs, i mostly wanted to get a temperature check on the kanji option in isolation |
Based on #1311, we now have separate "algebraic year" and calendar-specific "era year". This means we need to choose an anchor year for the Japanese calendar. I think there are two options on the table right now.
// Option 1
{
era: "reiwa",
eraYear: 3,
year: 152,
}
// Option 2
{
era: "reiwa",
eraYear: 3,
year: 2021
} |
I like the option of anchoring to CE 1, given that in Japanese (unlike AFAIK all other ICU calendars) there's no obvious default era to use. This would also sidestep a potentially politically controversial decision, per Wikipedia:
|
Instead of sidestepping that political decision, would anchoring to CE 1 possibly be wading into that controversial area - selecting an imperialist / pro-Christian reinforcement of the Gregorian calendar and/or US occupational history? |
Great point. I thought about this more and still think that making So instead of inventing a default era, which at best will be novel (thereby requiring developer education) and at worst may invite cultural complaints, seems like we should just accept that this is really the ISO calendar with an alternate way to describe years. If developers want to use the "Japanese calendar-ness" they can use I'm open to being overruled by folks who understand the cultural context, but for an initial default I feel safer in picking ISO than choosing an arbitrary era. |
Here's some context from a Japanese colleague of @sffc.
|
2021-01-29: We had a lengthy discussion about this today and decided to use the transliteration as the era identifier for the five modern eras (starting with meiji). For pre-meiji eras, we will use either a century syntax (like heisei-13xx) or just fall back to the Gregorian CE/BCE eras. |
I understand from @justingrant's comment the Japanese people would just like to stick to the ISO calendar for all dates before the Gregorian solar calendar was enforced. This is less controversial than choosing year ISO 1940 or year ISO -660 as a starting year. The Japanese people now stick to the Gregorian calendar and the western 7-days week, that come from western Europe. This seems not controversial. Even Saudi Arabia uses ISO8601 now. |
BTW, whichever solution is decided here should be aligned across legacy Date and Temporal. If |
Let's not tokenize Shane's coworker by suggesting that one Japanese-identifying person speaks for the entire Japanese populace :) Also, while many nations use the ISO8601 or similar calendars for many purposes, other calendars still have important cultural, religious, and civic uses in those countries and part of the point of calendar support in Temporal must be to enable those calendars that do not just look like ISO. |
Carrying over discussion from #1245 (comment) : Should the polyfill support all of the CLDR eras? Currently, there is a discrepancy between the eras supported by Intl and the eras supported in the polyfill. |
ECMA-402 issue: tc39/ecma402#541 The remaining action for Temporal is to implement whatever ECMA-402 decides on this topic in the polyfill. |
The Intl Era and Month Codes proposal exists for this purpose. This issue can remain open for the necessary integration between that proposal and this one, since engines will need to know the form of the codes in order to ship. |
Changed the title to reflect the action that needs to be taken for this issue. |
In all our pseudocode examples supposing a Japanese calendar thus far, we've been passing in era names as lowercased ASCII string identifiers made from English transliterations of the names, e.g.
{ year: 2, era: 'reiwa' }
for the current year. That requires that these identifiers are unique. However, that seems not to be the case as there are several eras written with different kanji but with the same English transliteration.The ICU names (which I guess must be for output only, not input) disambiguate this by adding a range of years to all of the era names in Latin locales except the most recent five. (For example in the C locale: https://github.com/unicode-org/icu/blob/master/icu4c/source/data/locales/root.txt#L1582-L1818)
What to do for input? Requiring the user to specify the era as a numerical index is extremely unergonomic, (for example,
{ year: 2, era: 181 }
) because they're not otherwise referred to numerically as far as I can tell. This could be mitigated with numeric constants?There must be some sort of prior art for software that does these calculations.
For background and a list of eras: https://en.wikipedia.org/wiki/Japanese_era_name — disclaimer, all I pretend to know about this calendar comes from that Wikipedia page.
This may be a problem in other calendars as well if they use non-numerical identifiers for things. I don't know if that's the case in any other calendars.
These are the duplicate names in the ICU data:
Note: Meitoku appears twice as well, from ISO years 1384–1387 and 1390–1394, but Wikipedia lists just one Meitoku era, and
new Date('1385-01-01').toLocaleString('ja-JP-u-ca-japanese', {era: 'short'})
shows the Genchū era instead.The text was updated successfully, but these errors were encountered: