[enh] add translatable strings to javascript - closes #461

This commit is contained in:
Adam Tauber 2020-06-15 18:25:05 +02:00
parent 6fb5c6aad9
commit 4ca0d8cb0f
11 changed files with 14 additions and 5 deletions

View File

@ -291,7 +291,7 @@ $(document).ready(function(){
}
})
.fail(function() {
$(result_table_loadicon).html($(result_table_loadicon).html() + "<p class=\"text-muted\">could not load data!</p>");
$(result_table_loadicon).html($(result_table_loadicon).html() + "<p class=\"text-muted\">"+could_not_load+"</p>");
});
}
}

Binary file not shown.

View File

@ -90,7 +90,7 @@ $(document).ready(function(){
}
})
.fail(function() {
$(result_table_loadicon).html($(result_table_loadicon).html() + "<p class=\"text-muted\">could not load data!</p>");
$(result_table_loadicon).html($(result_table_loadicon).html() + "<p class=\"text-muted\">"+could_not_load+"</p>");
});
}
}

Binary file not shown.

View File

@ -1314,7 +1314,7 @@ module.exports = AutoComplete;
})
.catch(function() {
result_table_loadicon.classList.remove('invisible');
result_table_loadicon.innerHTML = "could not load data!";
result_table_loadicon.innerHTML = could_not_load;
});
}
}

Binary file not shown.

View File

@ -97,7 +97,7 @@
})
.catch(function() {
result_table_loadicon.classList.remove('invisible');
result_table_loadicon.innerHTML = "could not load data!";
result_table_loadicon.innerHTML = could_not_load;
});
}
}

View File

@ -10,7 +10,7 @@
<meta name="referrer" content="no-referrer">
<meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" />
{% block meta %}{% endblock %}
<script src="{{ url_for('js_translations') }}"></script>
<title>{% block title %}{% endblock %}{{ instance_name }}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}" type="text/css" />
{% if preferences.get_value('oscar-style') -%}

View File

@ -12,6 +12,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<title>{% block title %}{% endblock %}{{ instance_name }}</title>
{% block meta %}{% endblock %}
<script src="{{ url_for('js_translations') }}"></script>
{% if rtl %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/searx-rtl.min.css') }}" type="text/css" media="screen" />
{% else %}

View File

@ -1021,6 +1021,14 @@ 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