Provide Server-side service to support UI localization #265 (#322)

merging
This commit is contained in:
Nanne Baars
2017-01-31 17:52:33 +01:00
committed by misfir3
parent 355393352e
commit ee5a12d205
71 changed files with 875 additions and 926 deletions

View File

@ -14,7 +14,7 @@ define(['jquery',
return {
initApp: function () {
var locale = localStorage.getItem('locale') || 'en';
$.getJSON('service/labels.mvc?lang=' + locale, function(data) {
$.getJSON('service/labels.mvc', function(data) {
window.polyglot = new Polyglot({phrases: data});
asyncErrorHandler.init();
var goatRouter = new Router();

View File

@ -148,13 +148,13 @@ define(['jquery',
},
renderFeedback: function(feedback) {
this.$curFeedback.html(feedback || "");
this.$curFeedback.html(polyglot.t(feedback) || "");
this.$curFeedback.show(400)
},
renderOutput: function(output) {
this.$curOutput.html(output || "");
this.$curOutput.html(polyglot.t(output) || "");
this.$curOutput.show(400)
},

View File

@ -6,7 +6,7 @@ function($,_,Backbone) {
el:'#header #lesson-title-wrapper',
render:function(title) {
var lessonTitleEl = $('<h1>',{id:'lesson-title',text:title});
var lessonTitleEl = $('<h1>',{id:'lesson-title',text:polyglot.t(title)});
this.$el.html(lessonTitleEl);
}
});