question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

labels not updating after changing language

See original GitHub issue

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 <select> dropdown):

$scope.changeLanguage = function (lngCode) {
    $i18next.options.lng = lngCode;
}

Any help would be much appreciated!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bugwellecommented, Jul 10, 2015

Sounds like your filter isn’t stateful.

Have a look at this article: http://blog.thoughtram.io/angularjs/2014/11/19/exploring-angular-1.3-stateful-filters.html We had a similar issue: https://github.com/i18next/ng-i18next/pull/66

Is your filter stateful? 😃 Maybe this helps.

Regards, Andre

0reactions
bugwellecommented, Jul 10, 2015

Well, I didn’t know about this, too… But thanks to the community we were able to fix this. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does android:label's text not changing when user ...
In my case, app won't change Actionbar language after change locale. It will change when I remove app from the recent app which...
Read more >
Update Labels is greyed out so I can't update labels for
Start with a label type mail merge main document and then after inserting the required content into the first label, Update the labels, ......
Read more >
Taxonomy field label not updated when changing language
We finally found a solution: There is a property in the Field tag; Overwrite="TRUE" . If this property is set, it will ignore...
Read more >
Language translation update not triggered under Manage ...
Hit on Download Custom Labels and observe that updated translations are not present.
Read more >
Changes to the Nutrition Facts Label - FDA
The updated label appears on the majority of food packages. Manufacturers with $10 million or more in annual sales were required to update...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found