EddyVerbruggen / nativescript-i18n

This is a plugin for Nativescript that implements native i18n in an easy manner.
65 stars 30 forks source link

i18n folder (default and from customLangPath) has no effect, only the native resources are working #76

Closed felixkrautschuk closed 4 years ago

felixkrautschuk commented 4 years ago

Environment:

According to the docs of this plugin, one should create an i18n folder in the app directory like this: Bildschirmfoto 2020-01-27 um 12 35 02

On my side, this folder has no effect, even when I'm defining a custom path for those resources and setting them in package.json, like it is done in the demo app, the language resources are not loaded. I'm not seeing any errors in the logs, but I also do not see the correct languages (only the keys like 'hello_world',...) on Android and iOS.

The only way to make languages working is defining them in the native App_Resources folders, so for Android:

Bildschirmfoto 2020-01-27 um 12 38 44

and for iOS:

Bildschirmfoto 2020-01-27 um 12 39 47

When I use the demo app of this repository, I can remove the app/resources/i18n folder and I get no error, as it seems that only the native language resources are used (on both Android and iOS).

Am I doing something completely wrong or are the docs not up-to-date?

xlmnxp commented 4 years ago

you should put i18n folder inside app folder not inside app/resources did you change appResourcesPath in nsconfig? plugin should use your custom paths

Fr3nky88 commented 4 years ago

[SOLVED] i have the same issue... this is my nsconfig.json { "appResourcesPath": "App_Resources", "appPath": "src" }

i put i18n dir in the app folder but it didn't work, then i put it like this: immagine but also didn't work...

what i'm wrong?

Thanks...

SOLUTION: debuggin the pre-hook script in the plugin i find the solution, the plugin look the folder named "/app/i18n" by default, adding this in the pakage.json: "nativescript-i18n": { "customLangPath": "src/i18n", "defaultLang": "it" } and putting the i18n folder in the "{rootProjectFolder}/src/i18n" it work and generate the file correctly.