-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update i18n.py to support better locale selection
The way we were naming locales in the selection dropdown, using only part of the language name, wasn't sufficient to distinguish simplified and traditional Chinese. It was also off for Norwegian, in that we were just calling it "Norsk", which isn't the complete language name, indicating which written standard we use (Bokmål). So I've changed it to use the complete language name, and include further distinguishing information as necessary when we have more than one translation for a language. We were also constructing the mapping of locale identifiers to display names every request, but always using the locale endonyms for the display names, instead of showing display names in the visitor's language, so it didn't need to be done per request. I moved the creation of the locale name map to the app setup. Our negotiation of locales using the request's accepted languages was also not working for Chinese, because we store the Chinese translations by language and script, not region, so if a browser indicated acceptable Chinese locales containing regions, they wouldn't be matched and the visitor's first contact would be in English. While cleaning up the locale selector presentation, I consolidated some of the things we were tacking onto the Flask g object into a container class, i18n.RequestLocaleInfo. The source metadata API endpoint could duplicate the default locale in its list of supported languages. That's been fixed.
- Loading branch information
Showing
19 changed files
with
335 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.