i18next / ng-i18next

translation for AngularJS using i18next
https://github.com/i18next/ng-i18next
MIT License
161 stars 54 forks source link

using inside a service #34

Closed dbones closed 10 years ago

dbones commented 10 years ago

Hi

we are trying to use this module in a service, but the service/filter is not initialized fully

//simplified example angular.module('ModuleName').service("AwesomeService", ['$i18next', function pollingTimer($i18next) {
function ctor() { var test = $i18next('gender.male'); //not initialized } ctor(); }]);

once it has loaded the translations it would work, but at this point it is too late

do you know how to inject this into a service correctly? or if it can be done?

thanks

bugwelle commented 10 years ago

Sorry for answering late.. Well, $i18next has to load the transaltions first. Have you tried to listen for $rootScope.$on('i18nextLanguageChange');? :) After this event has been triggered, $i18next should be ready to use.

Regards, Andre

bugwelle commented 10 years ago

Sine it's more than 2 months ago, that this issue has been active, I'll close this for now. You are free to reopen it ;)