Skip to content

Commit

Permalink
🐛 Fix bugs with I18Next
Browse files Browse the repository at this point in the history
* Make the app wait until the locale is loaded
* Change load path for locales
  • Loading branch information
wwebfor committed Jun 16, 2016
1 parent 3341652 commit 53453c4
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions app/scripts/helpers/i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,27 @@ define([
* Initialize i18next
*/
init: function() {
$.t = i18n.t.bind(i18n);
var defer = Q.defer();
$.t = i18n.t.bind(i18n);

return i18n
i18n
.use(XHR)
.init({
lng : __.getLang(),
fallbackLng : ['en'],
ns : [''],
defaultNS : '',
backend : {
loadPath : '../locales/{{lng}}/translation.json'
.init(
{
lng : __.getLang(),
fallbackLng : ['en'],
ns : [''],
defaultNS : '',
backend : {
loadPath : 'locales/{{lng}}/translation.json'
},
},
});
function() {
defer.resolve();
}
);

return defer.promise;
},

/**
Expand Down

0 comments on commit 53453c4

Please sign in to comment.