-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
LanguagesService: redirect "en" language code to "en_US" #14701
Conversation
@Eism Could you please try if this solves the issue for you? There are multiple ways to solve this; I'm now doing it without touching the languages hash, but alternatively we could make sure that we put "en" in the hash instead of "en_US", by making a special case in the |
@cbjeukendrup Maybe instead of
should be
The first found in the list will be selected, for now it is en_GB. (Or does the language have to be US?) |
Yes, the language should preferably be en_US if no other variant is specified explicitly. Anyway, I will try to come up with a more general mechanism to work around these problems. |
685192f
to
2d8f2f2
Compare
// If the user's system language is just "en", or "en_CY" for example, this will not be found. | ||
// So, for short codes that are at risk, we map them to long codes that we do have. | ||
// Should be kept in sync with languages.json. | ||
static const std::map<QString, QString> SHORT_TO_LONG_CODES { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can move it to configuration
Like fallbacksForLanguages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not moving it to configuration, because this relates quite closely to this tryCode
algorithm, and actually all logic about which languages we support happens in LanguagesService. I hope this is okay :)
…we do have For some languages, we only have long, specific codes in LanguagesHash / languages.json. If the user's system language is just "en", or "en_CY" for example, this will not be found. So, for short codes that are at risk, we map them to long codes that we do have.
2d8f2f2
to
3612ed0
Compare
should be merged to RC |
If the system language code happens to be something like "en_CY", that will decay to "en". But we don't have that, only "en_US". That causes some problems. To fix that, we map "en" to "en_US".
Might resolve: #13926
May resolve: #12917 (comment)