ngx-translate

Error when compiling Universal Angular with ngx-translate

ε祈祈猫儿з 提交于 2021-02-17 05:45:12
问题 I am configuring ngx-translate as follows: translate-server-loader.service.ts import {Observable} from "rxjs/Observable"; import {TranslateLoader} from '@ngx-translate/core'; import { Injectable } from '@angular/core'; import {makeStateKey, StateKey, TransferState} from '@angular/platform-browser'; import {TranslateHttpLoader} from '@ngx-translate/http-loader'; import {HttpClient} from '@angular/common/http'; @Injectable() export class TranslateBrowserLoader implements TranslateLoader {

Can I change the concatenation character of the String-Array regarding JHipsters 'jhiTranslate'?

前提是你 提交于 2021-02-11 07:15:35
问题 If I use a string array for translation in e.g. i18n/en/home.json like "primaryIntroduction": { "p1": [ "Then Jenkins triggers a task to connect to the docker-server", " and calls some docker- and docker-compose commands to pull the new image", " and rebuilds and restarts the docker-container." ] } jhipster concatenates the <p> on the english page like: Then Jenkins triggers a task to connect to the docker-server, and calls some docker- and docker-compose commands to pull the new image, and

Can I change the concatenation character of the String-Array regarding JHipsters 'jhiTranslate'?

我怕爱的太早我们不能终老 提交于 2021-02-11 07:10:26
问题 If I use a string array for translation in e.g. i18n/en/home.json like "primaryIntroduction": { "p1": [ "Then Jenkins triggers a task to connect to the docker-server", " and calls some docker- and docker-compose commands to pull the new image", " and rebuilds and restarts the docker-container." ] } jhipster concatenates the <p> on the english page like: Then Jenkins triggers a task to connect to the docker-server, and calls some docker- and docker-compose commands to pull the new image, and

Can I change the concatenation character of the String-Array regarding JHipsters 'jhiTranslate'?

那年仲夏 提交于 2021-02-11 07:09:09
问题 If I use a string array for translation in e.g. i18n/en/home.json like "primaryIntroduction": { "p1": [ "Then Jenkins triggers a task to connect to the docker-server", " and calls some docker- and docker-compose commands to pull the new image", " and rebuilds and restarts the docker-container." ] } jhipster concatenates the <p> on the english page like: Then Jenkins triggers a task to connect to the docker-server, and calls some docker- and docker-compose commands to pull the new image, and

How to use ngx-translate inside component

旧巷老猫 提交于 2021-02-10 06:42:08
问题 I am using ngx-translate inside my website, only problem is that i know how to use it inside html template it is working great, but how can i call key of JSON inside component? This is what i need i have app.html <div>{{"home" | translate }}</div> this is working ok, but inside component i have something like this this.Items = [ { title: 'Home', component: BookAServicePage, icon: 'settings' } ]; How can i replace this HOME to be read form a json file? 回答1: I was able to figure out a solution.

How to add translate for the breadcrumbs in coreui angular

风流意气都作罢 提交于 2021-01-29 09:47:38
问题 I am using coreui template for my angular application. In which i have added the @ngx-translate/core to translate my app. I have done translation for everything, but i couldn't add translation for the breadcrumbs provided by CoreUI. layout.html <div class="app-body"> <app-sidebar #appSidebar [fixed]="true" [display]="'lg'" [minimized]="sidebarMinimized" (minimizedChange)="toggleMinimize($event)" > <app-sidebar-nav [navItems]="navItems" [perfectScrollbar] [disabled]="appSidebar.minimized" ><

ngx-translate instant function is not a function thrown: Unit testing

邮差的信 提交于 2021-01-27 18:19:17
问题 I'm fairly new for unit testing and Angular, and i'm trying to write some unit tests for my project. The error i'm getting is; Uncaught TypeError: _this.translate.instant is not a function thrown Expected null to be truthy. The imports of the component.spec file includes beforeEach(async(() => { TestBed.configureTestingModule({ imports:[ ClarityModule, RouterTestingModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: (http: HttpClient) => new TranslateHttpLoader

ngx-translate with Angular 9 not working in IE showing compilation error SCRIPT1002

送分小仙女□ 提交于 2020-08-26 08:38:51
问题 After importing TranslateModule into my app module I am seeing an error in Internet Explorer SCRIPT1002 and when navigate to that line I am seeing a class TranslateLoader (there is the problem, IE doesn't know about class). My app is working in IE without that library so doesn't seem to be a polyfills issue there. Any help would be appreciated. Thanks. Using IE11. Happens in both dev mode and prod mode. 回答1: Not sure if this is the proper solution but it worked for me: I have downgraded ngx

ngx-translate with Angular 9 not working in IE showing compilation error SCRIPT1002

元气小坏坏 提交于 2020-08-26 08:36:08
问题 After importing TranslateModule into my app module I am seeing an error in Internet Explorer SCRIPT1002 and when navigate to that line I am seeing a class TranslateLoader (there is the problem, IE doesn't know about class). My app is working in IE without that library so doesn't seem to be a polyfills issue there. Any help would be appreciated. Thanks. Using IE11. Happens in both dev mode and prod mode. 回答1: Not sure if this is the proper solution but it worked for me: I have downgraded ngx

Angular 5 and ngx-translate with shared module loose translations if refresh

牧云@^-^@ 提交于 2020-08-24 12:51:00
问题 I have an angular app that uses ngx-translate. Below the versions: "@angular/core": "5.2.6", "@ngx-translate/core": "9.1.1", "@ngx-translate/http-loader": "2.0.1" In the AppModule class i added the import below: imports: [ ..... TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: (createTranslateLoader), deps: [HttpClient] } }) ...... ] ..... export function createTranslateLoader(http: HttpClient) { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); } And i