summaryrefslogtreecommitdiff
path: root/tests/unit/test_utils.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-10-12 21:50:05 +0200
committerGitHub <noreply@github.com>2021-10-12 21:50:05 +0200
commitee5e9f9e1d488d8d24086b8111ac6ecff4abd77a (patch)
tree3e42dc89cfbeb1e8b33a5d30dcbfd73713e860de /tests/unit/test_utils.py
parentb86aacdad65f8c18f01392a1a18d021006e55b21 (diff)
parent4759f65b69724589dcf1aafd04f7d7902952de98 (diff)
downloadsearxng-ee5e9f9e1d488d8d24086b8111ac6ecff4abd77a.tar.gz
searxng-ee5e9f9e1d488d8d24086b8111ac6ecff4abd77a.zip
Merge pull request #380 from dalf/fix-339
[fix] interface language zh_CN and zh_TW don't work
Diffstat (limited to 'tests/unit/test_utils.py')
-rw-r--r--tests/unit/test_utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py
index e9c247382..bea28c0cc 100644
--- a/tests/unit/test_utils.py
+++ b/tests/unit/test_utils.py
@@ -92,6 +92,14 @@ class TestUtils(SearxTestCase):
self.assertEqual(utils.match_language('es', [], fallback='fallback'), 'fallback')
self.assertEqual(utils.match_language('ja', ['jp'], {'ja': 'jp'}), 'jp')
+ # handle script tags
+ self.assertEqual(utils.match_language('zh-CN', ['zh-Hans-CN', 'zh-Hant-TW']), 'zh-Hans-CN')
+ self.assertEqual(utils.match_language('zh-TW', ['zh-Hans-CN', 'zh-Hant-TW']), 'zh-Hant-TW')
+ self.assertEqual(utils.match_language('zh-Hans-CN', ['zh-CN', 'zh-TW']), 'zh-CN')
+ self.assertEqual(utils.match_language('zh-Hant-TW', ['zh-CN', 'zh-TW']), 'zh-TW')
+ self.assertEqual(utils.match_language('zh-Hans', ['zh-CN', 'zh-TW', 'zh-HK']), 'zh-CN')
+ self.assertEqual(utils.match_language('zh-Hant', ['zh-CN', 'zh-TW', 'zh-HK']), 'zh-TW')
+
aliases = {'en-GB': 'en-UK', 'he': 'iw'}
# guess country