[fix] fix match_language issue to make zh-TW match to zh-Hant-TW

pybabel separates locales with underscores but we use hyphens
everywhere babel doesn't directly touch
This commit is contained in:
Marc Abonce Seguin 2021-10-04 22:44:58 -07:00 committed by Alexandre Flament
parent 4cc1ee8565
commit 66b7be0965
3 changed files with 32 additions and 6 deletions

View file

@ -211,12 +211,12 @@ class ViewsTestCase(SearxTestCase):
result = self.app.get('/preferences', headers={'Accept-Language': 'zh-tw;q=0.8'})
self.assertEqual(result.status_code, 200)
self.assertIn(
b'<option value="zh_TW" selected="selected">',
b'<option value="zh_Hant_TW" selected="selected">',
result.data,
'Interface locale ignored browser preference.'
)
self.assertIn(
b'<option value="zh-TW" selected="selected">',
b'<option value="zh_Hant_TW" selected="selected">',
result.data,
'Search language ignored browser preference.'
)