-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/text/language: language.TraditionalChinese.Parent() != language.Chinese #25603
Comments
The code that's causing the divergent behavior has the following explanation:
|
I guess my real question is “why?” |
cc @mpvl |
That comment seems to rule out the possibility that the behaviour you're observing is a bug. In general we don't use the issue tracker for questions, it's just for actual bugs.
Are you just curious, or the observed (and documented) behaviour is causing you troubles? |
Ultimately I am questioning the correctness/usefulness of this behavior. A simple reading of the godoc doesn’t give any guidance to this behavior so I think the expected behavior described above is reasonable and the actual behavior is surprising. As a user of this API, this caused an unexpected bug (which I was able to workaround): nicksnyder/go-i18n#107 If this is indeed working as intended then I think better documentation would satisfy me. I am also personally curious to understand the rational for this particular behavior. |
Okay, leaving this open then. Package owner @mpvl is likely the one that can answer your questions and make a decision about this. |
Change https://golang.org/cl/145437 mentions this issue: |
This behavior is defined in http://unicode.org/reports/tr35/#Parent_Locales The parent relationship is used to determine fallback data, or fields that can be inherited from "parent" languages. Generally this corresponds to stripping away the last part of a BCP 47 tag, but not always. In general, single-component tags typically apply some default script. For instance, Dutch is typically written in Latin script, so no use to write nl-Latn. However, some languages are commonly written in more than one script, and it would be bad for a user to fall back on a language for which the script is not understood. In the case of zh and zh_Hant it is even worse, as they do not only imply a different script, but also, with high likelihood, a different language (cmn_Hans and yue_Hant, respectively). I guess zh is still widely used as there is still a decent amount of mutual intelligibility between the written form of Chinese languages if written in the same script. But one should not assume mutual intelligibility between different scripts. Hence. |
Thanks for the explanation! The proposed documentation looks good to me. |
What version of Go are you using (
go version
)?go version go1.10.2 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
I expected
language.TraditionalChinese.Parent() == language.Chinese
What did you see instead?
language.TraditionalChinese.Parent() == language.Und
The text was updated successfully, but these errors were encountered: