actimeo / ng2-i18next

use i18next with Angular2
MIT License
11 stars 9 forks source link

Needed support for newest version of angular-cli #13

Open alexiusp opened 7 years ago

alexiusp commented 7 years ago

They have changed a bunch of staff in angular-cli already. Here is how I have made it work: in angular-cli.json in apps section: "scripts": [ "../node_modules/i18next/i18next.js", "../node_modules/i18next-xhr-backend/i18nextXHRBackend.js", "../node_modules/i18next-browser-languagedetector/i18nextBrowserLanguageDetector.js" ]

And then in app.module.ts some import: import { I18nDirective, I18nService, I18nServiceConfig } from 'ng2-i18next/ng2-i18next'

and providers are now defined so:

providers: [ { provide: I18nServiceConfig, useValue: { use: [i18nextBrowserLanguageDetector, i18nextXHRBackend], config: { detection: {order: ['navigator']}, fallbackLng: 'en' } } }, I18nService ]

DarkIsDude commented 7 years ago

@alexiusp Thanks for your update. But when I try it, I have an error: Error eval code.

I have detected that is use: [i18nextBrowserLanguageDetector, i18nextXHRBackend] the issue. You know why? You can help me?

alexiusp commented 7 years ago

@doudou34 Not sure, but may be you have forgot the first described section? or may be forgot to npm install these modules (i18nextBrowserLanguageDetector, i18nextXHRBackend) ?

DarkIsDude commented 7 years ago

@alexiusp thanks. I can't font how resolve my problem so I use another package: https://www.npmjs.com/package/ng2-translate

Romanchuk commented 6 years ago

@DarkIsDude @alexiusp Please check out package https://www.npmjs.com/package/angular-i18next