mirror of
https://github.com/searxng/searxng.git
synced 2025-07-23 05:09:17 +02:00
Fix locale and search language
Locale and search language was always defined with english value. This patch inits the locale on `pre_request` in order to define the default value of locale and language preferences. Plus the `best_match` function provided by flask babel library did not work as expected. So the function `match_language` provided by searx is used to detect that the language from Accepted-Language header can be used in searx project.
This commit is contained in:
parent
a818d3241d
commit
373a66be30
3 changed files with 25 additions and 8 deletions
|
@ -243,8 +243,8 @@ class Preferences(object):
|
|||
super(Preferences, self).__init__()
|
||||
|
||||
self.key_value_settings = {'categories': MultipleChoiceSetting(['general'], choices=categories + ['none']),
|
||||
'language': SearchLanguageSetting(settings['search']['language'],
|
||||
choices=LANGUAGE_CODES),
|
||||
'language': SearchLanguageSetting(settings['ui']['default_locale'],
|
||||
choices=list(LANGUAGE_CODES) + ['']),
|
||||
'locale': EnumStringSetting(settings['ui']['default_locale'],
|
||||
choices=list(settings['locales'].keys()) + ['']),
|
||||
'autocomplete': EnumStringSetting(settings['search']['autocomplete'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue