NathanWalker / nativescript-ng2-translate

Use ng2-translate with NativeScript + Angular2.
MIT License
6 stars 2 forks source link

Can't get this to work #9

Open JuergenSimon opened 6 years ago

JuergenSimon commented 6 years ago

Hi,

I'm trying to make this work in a Nativescript/Angular application (with Typescript). I have a setup with an application module, a child module (tab module), built from the tab-component template that comes with Nativescript. I'm not sure how to add this to my @NgModule declaration? Do I need to add it to the application module or the tab module? Or both? Where do I put the code that you have in this block:

nativeScriptBootstrap(TestComponent, [
  HTTP_PROVIDERS,
  provide(TranslateLoader, {
    useFactory: () => {
      // pass in the path to your locale files
      return new TNSTranslateLoader('assets/i18n');
    }
  }),
  TranslateService
]);

?

PS: I also tried plain ng2-translate but the |translate pipe never worked for me. Perhaps because it couldn't load the translation files?

JuergenSimon commented 6 years ago

I created an example project: https://github.com/JuergenSimon/translation-test

gustavost26 commented 5 years ago

Eu criei um projeto de exemplo: https://github.com/JuergenSimon/translation-test

This link is broken.