Closed sintecnos-lucabiffi closed 5 years ago
@sintecnos-lucabiffi did you install the plugin as devDependency or just as dependency, it should be install as dependency ot at least I have installed it as dependency and it is working
@ivayloc I just installed it with tns plugin add nativescript-localize
from terminal
Ok this happens on 3 different machines so I must be doing something really silly.
I tried with PCs with Windows7 and Windows10.
Steps to reproduce:
I use VS Code + NativeScript extension and create a project with
tns create my-project --template tns-template-blank-ng
Add plugin with
tns plugin add nativescript-localize
Add
import { NativeScriptLocalizeModule } from "nativescript-localize/angular";
and
NativeScriptLocalizeModule
(in angular imports)
into app.module.ts file
Run npm install
just to be sure.
Set i18n folden under "app" folder, so the complete path would be C:\path_to_my_project\src\app\i18n
Then run tns preview
and when I open the app the exception above described happens.
@sintecnos-lucabiffi if I remember correctly, NativeScript preview doesn't support plugins? Does it work when you just run tns run android
?
@abhayastudios You're very right, if I build the project and install the APK at least I don't get any Exception when launching the app. Thank you!
I tried a very simple application starting from the standard template tns-template-drawer-navigation-ng and made no changes whatsoever. I then installed this plugin and imported it as shown in the tutorial. I created the "i18n" folder with 2 json (one is en.default.json) as shown in the tutorial. The import fails and returns the exception below.
Android platform Nativescript 5.0.3 Nativescript localize 4.0.1