Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[#4413] Fix Chinese locales#6008

Merged
smotornyuk merged 4 commits into
masterfrom
4413-handle-chinese-locales
Apr 14, 2021
Merged

[#4413] Fix Chinese locales#6008
smotornyuk merged 4 commits into
masterfrom
4413-handle-chinese-locales

Conversation

@amercader
Copy link
Copy Markdown
Member

Fixes #4413

There's a fair amount of discussion in the issue but the main points are:

  • Visiting a URL with the zh_CN and zh_TW locales does not translate the content.
  • Babel / flask-babel expects folders named zh_Hans_CN and zh_Hant_TW.
  • We want to fix this, but keep old URLs like http://localhost:5000/zh_CN working (new one will be http://localhost:5000/zh_Hans_CN)
  • Transifex expects zh_CN and zh_TW

So this PR does:

  1. Rename the locale folders to what Babel expects
  2. Sets up redirect routes for the old legacy locale names (eg http://localhost:5000/zh_CN/dataset ->
    http://localhost:5000/zh_Hans_CN/dataset)
  3. Adds an alias to the Transifex config file to be able to push/pull normally

To the format expected by Babel
eg http://localhost:5000/zh_CN/dataset ->
http://localhost:5000/zh_Hant_TW/dataset
Which doesn't support the new Babel syntax
@spectatorcharlie
Copy link
Copy Markdown

spectatorcharlie commented Apr 13, 2021

Problem solved! Thanks for your help.

Based on #4413 (comment)

  1. cp -r zh_CN zh_Hans_CN
  2. cp -r zh_TW zh_Hant_TW
  3. Go to localhost:5000
  4. UI displays in correct language

@smotornyuk smotornyuk merged commit 116d37f into master Apr 14, 2021
@amercader amercader deleted the 4413-handle-chinese-locales branch April 14, 2021 10:38
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.

Flask-Babel does not translate zh_TW and zh_CN

3 participants