razorsyntax
razorsyntax

Reputation: 359

Nativescript Localize Dynamic Language Switching

Is it possible to dynamically switch language from within the Nativescript app. I'm using the Nativescript Localize plugin.

I'm building a user preferences page where a user can select their preferred language from a drop down.

If it's not possible with Nativescript Localize, does anyone have any experience doing this with another method/plugin?

It appears there are Angular ways to do this so I was hoping they'd work but they seem to limited to the browser since they use localStorage.

Upvotes: 0

Views: 603

Answers (1)

Manoj
Manoj

Reputation: 21908

Switching the language programatically is not supported by the plugin, but the plugin can be modified to do that.

On iOS, instead of getting main bundle you could modify the plugin to get bundle based on your language preference, here is an example written in Objective C.

Similarly for Android, you would have to get the Resources based on your locale preference instead of the active one.

Upvotes: 1

Related Questions