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

Fall back to primary subtag matching if an exact language code match fails #67

Open
Rob--W opened this issue Jun 21, 2015 · 0 comments
Open

Comments

@Rob--W
Copy link
Collaborator

Rob--W commented Jun 21, 2015

When a l10n file contains localizations for several language codes, but not the primary subtag, and the browser reports only the primary subtag, then this library fails to map the browser's language code to a l10n file.

For instance, in the following situation, one would expect the es-ES locale to be used because the primary subtag matches the browser's language (example from mozilla/pdf.js#6048 (comment)):

  • Localizations available in: es-ES
  • Primary subtag of es-ES (=letters before the first hyphen): es
  • Browser's language: es

This could easily be implemented by mapping primary subtags to the first language code with the same primary subtag if the localization data for the primary subtag is not specified.
Note that this operation does not always guarantee usable results, because there are language codes with identical primary subtags that are not mutually intelligible, az-Latin and az-Cyrl is given as an example by RFC 4646, section 4.2.

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

1 participant