Nativescript Localize Plugin Angular

plugins

#1

Hi there!

I’ve installed nativescript-localize plugin in my Nativescript-Angular app and it’s not working, I don’t have any error, apparently the strings are created succesfully and everything looks fine but the fact that I don’t get the translations and I wouldn’t know how to change the language so the pipe could point to another .json file with another strings in another language.

I’ve followed up the steps included in the plugin’s docs but still not working

Anyone could help? Thank you!


#2

I think nativescript-localize doesn’t do hot reload, so you need too re-build when you make changes to the translations json files


#3

Hi! I did rebuild but still didn’t work, it’s not showing the translation… Does it work for you?


#4

Yes it works for me, but I’m using in Plain Awesome NativeScript (PAN) not angular


#5

Ok, could you recreate the steps? I think, I’m not missing anything, but just in case. Thanks


#6

I just checked my app, there are no steps to recreate, I literally used the same instructions in the plugin main page.

Try to delete the following folders: platform, node-modules, hooks, and the created translation folders in your app resources and run again.

Maybe someone who is using the plugin in an angular project will be able to give you a better answer.


#7

I’ve run the app adding Webpack to the project and now it’s showing the default translation. How would you switch between languages? Thanks again!


#8

I don’t think you have the ability to switch translations manually. The language selection is made by the OS itself based on the current os language. However, I think having the ability to change language manually would be a nice feature. you should open a github feature request for that :slight_smile:


#9

Yes, sure be nice. What I want is to get similar behaviour than with the ngx-translate where you are definitely able to switch the language…


#10

Same problem for me.

@AlbertoAS92 did you solve it?.

Apparently, not recognize L pipe. Required imports in app.module are made

Thanks.


#11

I hope this helps someone.
Found the issue. When you add package dependency (nativescript-localize) and start using the language resources, you need to delete you language resource folder been created.

e.g. When you work in android enviroment: app\App_Resources\Android\values and app\App_Resources\Android\values-[language].

Then, you should rebuild and run or debug.