Skip to content
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

Language Chooser: Sometimes not showing autonym #40

Open
merchako opened this issue Dec 3, 2024 · 2 comments
Open

Language Chooser: Sometimes not showing autonym #40

merchako opened this issue Dec 3, 2024 · 2 comments

Comments

@merchako
Copy link

merchako commented Dec 3, 2024

Image

Expected behavior:

  • dominant label = Japanese language name in Japanese (autonym)
  • highlight search term

Actual behavior:

  • dominant label = anglicized Japanese language name (canonical endonym?)
@merchako merchako changed the title Sometimes not showing autonym Language Chooser: Sometimes not showing autonym Dec 3, 2024
@andrew-polk
Copy link
Contributor

andrew-polk commented Dec 3, 2024

For this example, the langtags data has localname and not localnames:

    {
        "full": "ja-Jpan-JP",
        "iana": [ "Japanese" ],
        "iso639_3": "jpn",
        "localname": "日本語",
        "name": "Japanese",
        "names": [ "Japonés", "Nikkei" ],
        "region": "JP",
        "regionname": "Japan",
        "regions": [ "AE", "AR", "AS", "AU", "BR", "CA", "DE", "DO", "FI", "FM", "GU", "HK", "MN", "MP", "MX", "NZ", "PA", "PE", "PH", "PW", "PY", "RU", "SG", "TH", "TW", "US" ],
        "script": "Jpan",
        "sldr": true,
        "suppress": true,
        "tag": "ja",
        "tags": [ "ja-JP", "ja-Jpan" ],
        "windows": "ja"
    }

But our code is ignoring localname:

function autonymOrFallback(entry: any, fallback: string | undefined) {
  // We are currently ignoring the "localname" field because it appears to be more specific than what we want,
  // e.g. the "es-Latn-ES" entry of langtags.json has "localname": "español de España" and "localnames": [ "castellano", "español" ]
  return entry.localnames ? entry.localnames[0] : fallback;
}

@nabalone, looks like we need to rethink this?

@nabalone
Copy link
Collaborator

nabalone commented Dec 4, 2024

Okay, I took a closer look and now I think it actually would be okay to fall back to the "localname" name value.

There are 73 languages with a "localname" value and no "localnames" value. I checked maybe 20 of them, and so far Spanish is the only such case I've seen where it looks like it would be problematic to use the "localname" value (and we are overwriting the Spanish card anyway). So I think we could use the "localname" value where there is no "localnames" value, and there would be very few if any cases where the name would be problematically narrow. And if there are such cases, hopefully the longer list of names will clarify things for the users.

We prefer "localnames" because it is what Ethnologue uses. See https://github.com/silnrsi/langtags/blob/master/doc/langtags.md
It look like the "localname" can be specific to the language-script-region combo it is listed under, but again I don't think that will be a big problem for us if we prioritize "localnames".

Will put in a PR.

Edit: PR is #40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants