Closed ValMilkevich closed 10 years ago
Hello and thanks for asking this question (no joking; question like this make this project better) :)
I never use CoffeeScript but the JavaScript code of your examples looks like this (using http://js2coffee.org/ ):
var locale;
locale = "en";
angular.module("jm.i18next").config([
"$i18nextProvider", function($i18nextProvider) {
return $i18nextProvider.options = {
interpolationPrefix: '%{',
interpolationSuffix: '}',
lng: locale,
resGetPath: '/locales/%{lng}.json'
};
}
]);
this.app = angular.module('homekit', ['templates', 'ngRoute', 'ngResource', "jm.i18next"]);
So you want to change the language? It's possible and not hard to implement. Just have a look on this: https://github.com/archer96/ng-i18next/blob/master/examples/directive/directive.js#L62 (line 62). You simply change $i18next.options.lng
to whatever language you want ;)
ng-i18next
watches for changes on $i18next.options
.
For examples see https://github.com/archer96/ng-i18next#examples .
Regards, Andre
Andre, thanks for such a quick reply! https://github.com/archer96/ng-i18next/blob/master/examples/directive/directive.js#L62 - helps a lot!
:)
I think this issue can now be closed.
Hi, first of this is awesome project! thank you so much!
I'm currently trying to implement the dynamic language change, please may you let me know if that is possible at all?
My main.js.coffee looks like the following:
the question is - if it is possible to change the locale of the application from within the angular controller ?