Commit 8a1f5aff authored by Michal Čihař's avatar Michal Čihař

Expose list of machine translation services to javascript

parent 5268cf1b
...@@ -246,6 +246,9 @@ def js_config(request): ...@@ -246,6 +246,9 @@ def js_config(request):
else: else:
microsoft_langs = None microsoft_langs = None
# Machine translation
machine_services = MACHINE_TRANSLATION_SERVICES.keys()
return render_to_response( return render_to_response(
'js/config.js', 'js/config.js',
RequestContext( RequestContext(
...@@ -253,6 +256,7 @@ def js_config(request): ...@@ -253,6 +256,7 @@ def js_config(request):
{ {
'apertium_langs': apertium_langs, 'apertium_langs': apertium_langs,
'microsoft_langs': microsoft_langs, 'microsoft_langs': microsoft_langs,
'machine_services': machine_services,
} }
), ),
mimetype='application/javascript' mimetype='application/javascript'
......
...@@ -10,3 +10,4 @@ var MICROSOFT_API_KEY = '{{ microsoft_api_key }}'; ...@@ -10,3 +10,4 @@ var MICROSOFT_API_KEY = '{{ microsoft_api_key }}';
{% if microsoft_langs %} {% if microsoft_langs %}
var MICROSOFT_LANGS = ['{{ microsoft_langs|join:"','" }}']; var MICROSOFT_LANGS = ['{{ microsoft_langs|join:"','" }}'];
{% endif %} {% endif %}
var MACHINE_TRANSLATION_SERVICES = [{% if machine_services %}'{{ machine_services|join:"','" }}'{% endif %}];
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment