We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Flask-Babel does not translate zh_TW and zh_CN
### CKAN Version if known (or site URL)

≧ 2.8.0

### Please describe the expected behaviour

When switching to ``zh_TW`` or ``zh_CN`` languages on the pages written in Flask (ex. ``/`` and ``/user``), the pages should be shown in corresponding languages.

### Please describe the actual behaviour

It shows English instead of ``zh_TW`` or ``zh_CN``.

### What steps can be taken to reproduce the issue? 

Switch language to Chinese on the above-mentioned pages.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ckan/views/home.py`
Content:
```
1 # encoding: utf-8
2 
3 from flask import Blueprint, abort
4 
5 import ckan.model as model
6 import ckan.logic as logic
7 import ckan.lib.base as base
8 import ckan.lib.search as search
9 import ckan.lib.helpers as h
10 
11 from ckan.common import g, config, _
12 
13 CACHE_PARAMETERS = [u'__cache', u'__no_cache__']
14 
15 
16 home = Blueprint(u'home', __name__)
17 
18 
19 @home.before_request
20 def before_request():
21     u'''set context and check authorization'''
22     try:
23         context = {
24             u'model': model,
25             u'user': g.user,
26             u'auth_user_obj': g.userobj}
27         logic.check_access(u'site_read', context)
28     except logic.NotAuthorized:
29         abort(403)
30 
31 
32 def index():
33     u'''display home page'''
34     try:
35         context = {u'model': model, u'session': model.Session,
36                    u'user': g.user, u'auth_user_obj': g.userobj}
37         data_dict = {u'q': u'*:*',
38                      u'facet.field': h.facets(),
39                      u'rows': 4,
40                      u'start': 0,
41                      u'sort': u'view_recent desc',
42                      u'fq': u'capacity:"public"'}
43         query = logic.get_action(u'package_search')(context, data_dict)
44         g.search_facets = query['search_facets']
45         g.package_count = query['count']
46         g.datasets = query['results']
47 
48         org_label = h.humanize_entity_type(
49             u'organization',
50             h.default_group_type(u'organization'),
51             u'facet label') or _(u'Organizations')
52 
53         group_label = h.humanize_entity_type(
54             u'group',
55             h.default_group_type(u'group'),
56             u'facet label') or _(u'Groups')
57 
58         g.facet_titles = {
59             u'organization': org_label,
60             u'groups': group_label,
61             u'tags': _(u'Tags'),
62             u'res_format': _(u'Formats'),
63             u'license': _(u'Licenses'),
64         }
65 
66     except search.SearchError:
67         g.package_count = 0
68 
69     if g.userobj and not g.userobj.email:
70         url = h.url_for(controller=u'user', action=u'edit')
71         msg = _(u'Please <a href="%s">update your profile</a>'
72                 u' and add your email address. ') % url + \
73             _(u'%s uses your email address'
74                 u' if you need to reset your password.') \
75             % config.get(u'ckan.site_title')
76         h.flash_notice(msg, allow_html=True)
77     return base.render(u'home/index.html', extra_vars={})
78 
79 
80 def about():
81     u''' display about page'''
82     return base.render(u'home/about.html', extra_vars={})
83 
84 
85 util_rules = [
86     (u'/', index),
87     (u'/about', about)
88 ]
89 for rule, view_func in util_rules:
90     home.add_url_rule(rule, view_func=view_func)
91
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/ckan/views/home.py b/ckan/views/home.py
--- a/ckan/views/home.py
+++ b/ckan/views/home.py
@@ -1,6 +1,6 @@
 # encoding: utf-8
 
-from flask import Blueprint, abort
+from flask import Blueprint, abort, redirect
 
 import ckan.model as model
 import ckan.logic as logic
@@ -82,9 +82,36 @@
     return base.render(u'home/about.html', extra_vars={})
 
 
+def redirect_locale(target_locale, path=None):
+    target = f'/{target_locale}/{path}' if path else f'/{target_locale}'
+    return redirect(target, code=308)
+
+
 util_rules = [
     (u'/', index),
     (u'/about', about)
 ]
 for rule, view_func in util_rules:
     home.add_url_rule(rule, view_func=view_func)
+
+locales_mapping = [
+    ('zh_TW', 'zh_Hant_TW'),
+    ('zh_CN', 'zh_Hans_CN'),
+]
+
+for locale in locales_mapping:
+
+    legacy_locale = locale[0]
+    new_locale = locale[1]
+
+    home.add_url_rule(
+        f'/{legacy_locale}/',
+        view_func=redirect_locale,
+        defaults={'target_locale': new_locale}
+    )
+
+    home.add_url_rule(
+        f'/{legacy_locale}/<path:path>',
+        view_func=redirect_locale,
+        defaults={'target_locale': new_locale}
+    )

{"golden_diff": "diff --git a/ckan/views/home.py b/ckan/views/home.py\n--- a/ckan/views/home.py\n+++ b/ckan/views/home.py\n@@ -1,6 +1,6 @@\n # encoding: utf-8\n \n-from flask import Blueprint, abort\n+from flask import Blueprint, abort, redirect\n \n import ckan.model as model\n import ckan.logic as logic\n@@ -82,9 +82,36 @@\n     return base.render(u'home/about.html', extra_vars={})\n \n \n+def redirect_locale(target_locale, path=None):\n+    target = f'/{target_locale}/{path}' if path else f'/{target_locale}'\n+    return redirect(target, code=308)\n+\n+\n util_rules = [\n     (u'/', index),\n     (u'/about', about)\n ]\n for rule, view_func in util_rules:\n     home.add_url_rule(rule, view_func=view_func)\n+\n+locales_mapping = [\n+    ('zh_TW', 'zh_Hant_TW'),\n+    ('zh_CN', 'zh_Hans_CN'),\n+]\n+\n+for locale in locales_mapping:\n+\n+    legacy_locale = locale[0]\n+    new_locale = locale[1]\n+\n+    home.add_url_rule(\n+        f'/{legacy_locale}/',\n+        view_func=redirect_locale,\n+        defaults={'target_locale': new_locale}\n+    )\n+\n+    home.add_url_rule(\n+        f'/{legacy_locale}/<path:path>',\n+        view_func=redirect_locale,\n+        defaults={'target_locale': new_locale}\n+    )\n", "issue": "Flask-Babel does not translate zh_TW and zh_CN\n### CKAN Version if known (or site URL)\r\n\r\n\u2267 2.8.0\r\n\r\n### Please describe the expected behaviour\r\n\r\nWhen switching to ``zh_TW`` or ``zh_CN`` languages on the pages written in Flask (ex. ``/`` and ``/user``), the pages should be shown in corresponding languages.\r\n\r\n### Please describe the actual behaviour\r\n\r\nIt shows English instead of ``zh_TW`` or ``zh_CN``.\r\n\r\n### What steps can be taken to reproduce the issue? \r\n\r\nSwitch language to Chinese on the above-mentioned pages.\n", "before_files": [{"content": "# encoding: utf-8\n\nfrom flask import Blueprint, abort\n\nimport ckan.model as model\nimport ckan.logic as logic\nimport ckan.lib.base as base\nimport ckan.lib.search as search\nimport ckan.lib.helpers as h\n\nfrom ckan.common import g, config, _\n\nCACHE_PARAMETERS = [u'__cache', u'__no_cache__']\n\n\nhome = Blueprint(u'home', __name__)\n\n\n@home.before_request\ndef before_request():\n    u'''set context and check authorization'''\n    try:\n        context = {\n            u'model': model,\n            u'user': g.user,\n            u'auth_user_obj': g.userobj}\n        logic.check_access(u'site_read', context)\n    except logic.NotAuthorized:\n        abort(403)\n\n\ndef index():\n    u'''display home page'''\n    try:\n        context = {u'model': model, u'session': model.Session,\n                   u'user': g.user, u'auth_user_obj': g.userobj}\n        data_dict = {u'q': u'*:*',\n                     u'facet.field': h.facets(),\n                     u'rows': 4,\n                     u'start': 0,\n                     u'sort': u'view_recent desc',\n                     u'fq': u'capacity:\"public\"'}\n        query = logic.get_action(u'package_search')(context, data_dict)\n        g.search_facets = query['search_facets']\n        g.package_count = query['count']\n        g.datasets = query['results']\n\n        org_label = h.humanize_entity_type(\n            u'organization',\n            h.default_group_type(u'organization'),\n            u'facet label') or _(u'Organizations')\n\n        group_label = h.humanize_entity_type(\n            u'group',\n            h.default_group_type(u'group'),\n            u'facet label') or _(u'Groups')\n\n        g.facet_titles = {\n            u'organization': org_label,\n            u'groups': group_label,\n            u'tags': _(u'Tags'),\n            u'res_format': _(u'Formats'),\n            u'license': _(u'Licenses'),\n        }\n\n    except search.SearchError:\n        g.package_count = 0\n\n    if g.userobj and not g.userobj.email:\n        url = h.url_for(controller=u'user', action=u'edit')\n        msg = _(u'Please <a href=\"%s\">update your profile</a>'\n                u' and add your email address. ') % url + \\\n            _(u'%s uses your email address'\n                u' if you need to reset your password.') \\\n            % config.get(u'ckan.site_title')\n        h.flash_notice(msg, allow_html=True)\n    return base.render(u'home/index.html', extra_vars={})\n\n\ndef about():\n    u''' display about page'''\n    return base.render(u'home/about.html', extra_vars={})\n\n\nutil_rules = [\n    (u'/', index),\n    (u'/about', about)\n]\nfor rule, view_func in util_rules:\n    home.add_url_rule(rule, view_func=view_func)\n", "path": "ckan/views/home.py"}], "after_files": [{"content": "# encoding: utf-8\n\nfrom flask import Blueprint, abort, redirect\n\nimport ckan.model as model\nimport ckan.logic as logic\nimport ckan.lib.base as base\nimport ckan.lib.search as search\nimport ckan.lib.helpers as h\n\nfrom ckan.common import g, config, _\n\nCACHE_PARAMETERS = [u'__cache', u'__no_cache__']\n\n\nhome = Blueprint(u'home', __name__)\n\n\n@home.before_request\ndef before_request():\n    u'''set context and check authorization'''\n    try:\n        context = {\n            u'model': model,\n            u'user': g.user,\n            u'auth_user_obj': g.userobj}\n        logic.check_access(u'site_read', context)\n    except logic.NotAuthorized:\n        abort(403)\n\n\ndef index():\n    u'''display home page'''\n    try:\n        context = {u'model': model, u'session': model.Session,\n                   u'user': g.user, u'auth_user_obj': g.userobj}\n        data_dict = {u'q': u'*:*',\n                     u'facet.field': h.facets(),\n                     u'rows': 4,\n                     u'start': 0,\n                     u'sort': u'view_recent desc',\n                     u'fq': u'capacity:\"public\"'}\n        query = logic.get_action(u'package_search')(context, data_dict)\n        g.search_facets = query['search_facets']\n        g.package_count = query['count']\n        g.datasets = query['results']\n\n        org_label = h.humanize_entity_type(\n            u'organization',\n            h.default_group_type(u'organization'),\n            u'facet label') or _(u'Organizations')\n\n        group_label = h.humanize_entity_type(\n            u'group',\n            h.default_group_type(u'group'),\n            u'facet label') or _(u'Groups')\n\n        g.facet_titles = {\n            u'organization': org_label,\n            u'groups': group_label,\n            u'tags': _(u'Tags'),\n            u'res_format': _(u'Formats'),\n            u'license': _(u'Licenses'),\n        }\n\n    except search.SearchError:\n        g.package_count = 0\n\n    if g.userobj and not g.userobj.email:\n        url = h.url_for(controller=u'user', action=u'edit')\n        msg = _(u'Please <a href=\"%s\">update your profile</a>'\n                u' and add your email address. ') % url + \\\n            _(u'%s uses your email address'\n                u' if you need to reset your password.') \\\n            % config.get(u'ckan.site_title')\n        h.flash_notice(msg, allow_html=True)\n    return base.render(u'home/index.html', extra_vars={})\n\n\ndef about():\n    u''' display about page'''\n    return base.render(u'home/about.html', extra_vars={})\n\n\ndef redirect_locale(target_locale, path=None):\n    target = f'/{target_locale}/{path}' if path else f'/{target_locale}'\n    return redirect(target, code=308)\n\n\nutil_rules = [\n    (u'/', index),\n    (u'/about', about)\n]\nfor rule, view_func in util_rules:\n    home.add_url_rule(rule, view_func=view_func)\n\nlocales_mapping = [\n    ('zh_TW', 'zh_Hant_TW'),\n    ('zh_CN', 'zh_Hans_CN'),\n]\n\nfor locale in locales_mapping:\n\n    legacy_locale = locale[0]\n    new_locale = locale[1]\n\n    home.add_url_rule(\n        f'/{legacy_locale}/',\n        view_func=redirect_locale,\n        defaults={'target_locale': new_locale}\n    )\n\n    home.add_url_rule(\n        f'/{legacy_locale}/<path:path>',\n        view_func=redirect_locale,\n        defaults={'target_locale': new_locale}\n    )\n", "path": "ckan/views/home.py"}]}