ngx-translate

How can I use two translators first for JSON file and second for firestore?

扶醉桌前 提交于 2019-12-22 01:32:02
问题 JSON File Method export function createTranslateLoader(http: HttpClient) { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); } JSON File Loader TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: (createTranslateLoader), deps: [HttpClient] } }), AngularFirestore Method export function FirestoreTranslationsLoaderFactory(db: AngularFirestore) { return new FirestoreTransLoader(db); } AngularFirestore File Loader TranslateModule.forRoot({ loader: { provide:

ngx-translation issue with ionic 3 app

爷,独闯天下 提交于 2019-12-21 05:38:37
问题 ngx translation with ionic 3 app not working for me. below is my code: app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { ErrorHandler, NgModule } from '@angular/core'; import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular'; import { HttpModule,Http } from '@angular/http'; import { IonicStorageModule } from '@ionic/storage'; import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx

Use ngx-translate in a multi-module Angular setup and child-libraries

拈花ヽ惹草 提交于 2019-12-21 04:39:16
问题 I am using ngx-translate for translation in my Angular app. It works just fine with a simple project setup, but we develop a large-scale business application and different components are split into several seperate libraries. Some of the libraries do need to have some translations and of course translation should change for all parts of the app with a click on the same button. Using angular-librarian for bundling the component libraries I have so far not been succesful to just create one

Argument of type 'Http' is not assignable to parameter of type 'Http' in Ionic ngx-translate

烈酒焚心 提交于 2019-12-21 03:47:13
问题 I'm developing an Ionic 2 mobile app and want to use ngx-translate features. Following the tutorial, I'm importing necessary files in app module like this: import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { HttpModule, Http } from '@angular/http'; ... export function createTranslateLoader(http: Http) { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); } which gives the error:

Angular ngx-translate usage in typescript

拥有回忆 提交于 2019-12-20 09:36:26
问题 I'm using this @ngx-translate/core i18n service and it works fine in templates (.html) with this syntax: {{'my.i18n.key'|translate}} Now I want to translate something in my component typescript file (.ts) but I don't know how to use it. I can create translate object in my constructor: constructor(private translate: TranslateService) {} and now how to translate 'my.i18n.key' ? 回答1: From the doc on github: get(key: string|Array, interpolateParams?: Object): Observable: Gets the translated value

ngx-translate with dynamic text on ts file

半城伤御伤魂 提交于 2019-12-19 02:51:09
问题 I'm using ngx-translate for internationalization on Ionic 3 app. I have used pipe nicely on HTML code. But now I have a situation like below on ts file. Can you tell me how to handle such dynamic use case with ngx ? updateApi(topic) { this.showToast(`Topic ${topic.name} subscribed!`);//this is the dynamic text } showToast(message) { let toast = this.toastCtrl.create({ message: message, duration: 3000 }); toast.present(); } The problem here is I don't know the value of ${topic.name} up front.

Angular 5 internationalization

爱⌒轻易说出口 提交于 2019-12-17 15:29:58
问题 I'm building an application using the latest Angular5 and what I need is for a user to be able to switch languages. I've never had to implement this in an Angular2+ (actually I'm using Angular5). I need to set translations in two places: Component's template html - change labels to the specified language In code in the component.ts file - I may need to translate some strings that are built dynamically under particular conditions in the code I was looking at ngx-translation and it looks to do

The pipe 'translate' could not be found error is showing In Ionic 4

微笑、不失礼 提交于 2019-12-13 18:41:16
问题 I am working in my Ionic 4 App and I have installed the ngx-translate plugin. It is working fine in app.component.html but in tabs.page.html it is showing the error. The pipe 'translate' could not be found This is my app.component.html : <ion-list class="mylist22" color="myheader"> <ion-item color="myheader"> <ion-label>Gender</ion-label> <ion-select [(ngModel)]="languageSelected" (ionChange)='setLanguage()'> <ion-select-option value="en" selected>English</ion-select-option> <ion-select

ionic2 apply ngx-translate for menu items

♀尐吖头ヾ 提交于 2019-12-13 17:21:34
问题 I am using ngx-translate for multi language support and it is working fine. but i want to apply for menu items also. How do i achieve this. I have 3 menu items, i want to change the language for every title. ts file appPages: PageObj[] = [ { title: 'Profile', component: ProfilePage, icon: 'person' }, { title: 'My Account', component: MyaccountPage, index: 1, icon: 'cash' }, { title: 'FAQ', component: FaqPage, index: 3, icon: 'chatbubbles' } ]; HTML <button ion-item menuClose *ngFor="let p of

i18n with ngrx store - translating angular application

丶灬走出姿态 提交于 2019-12-12 23:38:41
问题 I'm writing to ask you for advice. We build store based angular application, which requires translation. The request is to use official angular i18n method, although I have no idea how to connect my translations with values from the store. Is it even possible, does anyone have any experience with this or should I straight away go to the solutions like ngx-translate library..? I must say I researched quite a bit, but have not found understandable (I'm a junior and it's pretty hard for me to