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

Locale fallback #176

Merged
merged 4 commits into from
Sep 29, 2019
Merged

Locale fallback #176

merged 4 commits into from
Sep 29, 2019

Conversation

c960657
Copy link
Contributor

@c960657 c960657 commented Sep 17, 2019

This PR is a new version of #124 (the previous version exploded in a giant conflict) that has been detangled from #123.

This PR adds support for fallback locales. This has two major purposes:

  1. The available translations are rather sparse, i.e. each provider only has full support for a few locales. When using a locale that is not fully supported, you may want to try a number of locales before falling back to English. It depends e.g. on whether your users are likely to understand the local language.
  2. Allowing fallback from e.g. en_US to en introduces a kind of inheritance, so that strings shared between English variants are represented only once, while still allowing override for specific countries. This allows us to provide translations for all 102 en_* locales without repeating same same strings 102 times. This change makes the translation files less redundant, and we support a lot more locales.

Regarding #2: I removed duplicate entries for existing translations (e.g. if en_US, en_GB and all other variants were identical, I simply replaced them with one en entry). If there was a difference between e.g. de_DE and de_AT, I generally chose the larger country as the general translation (i.e. the translation for de_DE becomes de). This is somewhat arbitrary, but it can easily be changed later on without changing the currently supported locales (it only affects locales that are not currently supported).

Keep public interface unchanged.
This was referenced Sep 18, 2019
@stelgenhof stelgenhof added this to the v2.2.0 milestone Sep 26, 2019
@stelgenhof
Copy link
Member

Are you anticipating more changes to this PR? I'd like to review it and make it part of version 2.2

Cheers! Sacha

@c960657
Copy link
Contributor Author

c960657 commented Sep 28, 2019

I just pushed a few minor updates, but I don't anticipate any further changes.

@stelgenhof stelgenhof merged commit 4b4e172 into azuyalabs:develop Sep 29, 2019
@c960657 c960657 deleted the locale-fallback-v3 branch October 23, 2019 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants