diff options
| author | Alexandre Flament <alex@al-f.net> | 2021-03-16 11:07:04 +0100 |
|---|---|---|
| committer | Alexandre Flament <alex@al-f.net> | 2021-03-16 11:22:21 +0100 |
| commit | 6553c7902925809fd1cbc904dd08db035466a6b2 (patch) | |
| tree | b19fa74d6027dd64bd9f3b04b3b71f627940d20b /searx/webapp.py | |
| parent | cb3b379161e3351d4829b2e37478125582b9fc08 (diff) | |
[mod] replace /translations.js by embedded JSON
In webapp.py, there is a new function "get_translations" lists available translations
Close #2064
Diffstat (limited to 'searx/webapp.py')
| -rwxr-xr-x | searx/webapp.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 062077292..6f0297a99 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -362,6 +362,15 @@ def image_proxify(url): urlencode(dict(url=url.encode(), h=h))) +def get_translations(): + return { + # when overpass AJAX request fails (on a map result) + 'could_not_load': gettext('could not load data'), + # when there is autocompletion + 'no_item_found': gettext('No item found') + } + + def render(template_name, override_theme=None, **kwargs): disabled_engines = request.preferences.engines.get_disabled() @@ -421,6 +430,8 @@ def render(template_name, override_theme=None, **kwargs): kwargs['brand'] = brand + kwargs['translations'] = json.dumps(get_translations(), separators=(',', ':')) + kwargs['scripts'] = set() kwargs['endpoint'] = 'results' if 'q' in kwargs else request.endpoint for plugin in request.user_plugins: @@ -1084,14 +1095,6 @@ def config(): }) -@app.route('/translations.js') -def js_translations(): - return render( - 'translations.js.tpl', - override_theme='__common__', - ), {'Content-Type': 'text/javascript; charset=UTF-8'} - - @app.errorhandler(404) def page_not_found(e): return render('404.html'), 404 |