i18next / ng-i18next

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

labels not updating after changing language #92

Closed fikkatra closed 9 years ago

fikkatra commented 9 years ago

I ran into an issue when changing the language dynamically, using '$i18next.options.lng' in a controller. The labels are not updated automatically to the new language. I see the i18n cookie changing to the new language, so the language change has been executed correctly. However, the labels are only updated when I navigate away from the screen and back (this is client side routing with angular routing and does not trigger a page reload). This last observation made me believe a digest cycle was missing after the language change, but manually triggering a digest showed that a digest was in fact already happening. Any idea why the labels aren't updated immediately?

Lib versions: Ionic 1.0.0 with angular 1.3.13 i18next 1.10.1 ng-i18next 0.5.0, but I tested with various previous versions, to no avail

Config:

    $i18nextProvider.options = {
        useCookie: true,
        fallbackLng: 'nl-BE',
        ns: 'translations',
        resGetPath: 'locales/__ns__.__lng__.json',
        getAsync: false
    };

Controller code (triggered on selecting a language from a