Questions tagged [ng2-translate]
89 questions
26
votes
3 answers
The pipe 'translate' could not be found , angular2 component testing
I am working on component testing with angular2.
in my html template i use the translate pipe.
This is the code of the test :
import { ComponentFixture, TestBed ,getTestBed} from '@angular/core/testing';
import { By } from…

user3518668
- 359
- 1
- 4
- 14
10
votes
2 answers
ng2-translate: Cannot read property 'subscribe' of undefined at TranslatePipe.transform
I use ng2-translate in my Angular 5 project and I am trying to create a unit test for one component.
I always import TranslateModule.forRoot( *...* ) in my Tests and the tests will work using the translate pipe in my views.
In two cases though, the…

Rias
- 1,956
- 22
- 33
10
votes
2 answers
How to update .json file without rebuilding in angular cli?
I'm using angular cli to build a website which contains multiple languages. I use ng2-translate for the translations.
I import a languages.json file defined in angular-cli.json:
"assets": [
"assets",
"fonts",
"languages.json"
],
In my…

Tom Shen
- 1,045
- 3
- 11
- 29
8
votes
2 answers
Using ng2-translate with parameters
I tried to use ng2-translate with parameters in the template:
{{ test | translation:{value:param} }}
And it works perfectly. I would like to build my translation in my typescript and I saw this function:
get(key: string|Array,…

Julien Moreau
- 151
- 1
- 4
- 16
8
votes
5 answers
Angular2 and webpack - i18n plugin vs ng2-translate
I want to build a web-application with angular2 and bundle this with webpack.
What is the best way for providing multiple languages:
i18n-plugin: https://github.com/webpack/i18n-webpack-plugin
or
ng2-translate:…

circy
- 199
- 1
- 3
- 10
7
votes
1 answer
How to unit test ng2-translate using karma-jasmine in Angular2
I'm trying to translate the page with German and English option using ng2-translate.
navbar.component.html

Protagonist
- 1,649
- 7
- 34
- 56
6
votes
2 answers
ngx-translate: translations are not shown on reload
In my webapp, I use ngx-translate module for localization. It works ok for html strings which I translate using pipes. I am having problems with strings translated in my ts components. Strings get translate but if I reload page they are empty…

OjamaYellow
- 899
- 1
- 13
- 27
6
votes
3 answers
@ngx-translate with different module
I have application with many modules. I am using ngx-translate for multilingual functionality. But, it's not working.
i18n.module.ts
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import {…

Yashasvi
- 197
- 1
- 3
- 6
6
votes
2 answers
ng2-translate not working in lazy-loaded module
I'm using ng2-translate for language handling in an Angular 2 RC5 app I'm creating. The app has two feature modules, one lazy loaded and one eager loaded. TranslateModule is made available through a shared module. The problem is that the translate…

Jason
- 2,455
- 4
- 37
- 48
5
votes
0 answers
Angular 4 with Universal + ng2-translate
I'm currently implementing Angular Universal to my app. I already had a bunch of errors to resolve but i'm stuck to this one.
I can build my app, the aot compilation is working fine but when I run my server that should bootstrap my app I can see…

Valentin Jed
- 491
- 4
- 8
5
votes
0 answers
Angular 1 and Angular 2 hybrid application with ng2-translate NoProviderError
i have legacy application written in Angular 1.5 and i want to add new components written in Angular 2
But i have problems with ng2-translate
so here is my component
home.ts
import {Component} from '@angular/core';
import {TranslateService,…

VladosJS
- 1,210
- 8
- 20
4
votes
2 answers
JSON files are not loading in ng2-translate with webpack
I'm trying to implement ng2-translate i18n.
dashboard.component.ts
import { Component } from '@angular/core';
import {TranslateService} from 'ng2-translate';
@Component({
selector: 'dashboard-page',
template:`
{{ 'HOME.TITLE'…

Protagonist
- 1,649
- 7
- 34
- 56
4
votes
1 answer
ng2-translate: Is there any way to use default lang in case of Missing Translations?
I am using angular2 rc5 and for i18n ng2-translate.
I want MissingTranslationHandler to automatically fall down to default language rather than providing explicit translations for missing values .
Is it possible to do in any way?

user1442058
- 51
- 2
4
votes
3 answers
Issue on Angular 2 RC5 with global pipes
I'm having some troubles integrating the ng2-translate in angular 2 RC5 for other components different than the main app.
I want to use the pipe globally, and in a research i found that probably i need to use a "provider" (but that is on RC4), and…

Ricardo Daniel
- 421
- 7
- 15
4
votes
1 answer
ng2-translate - Translation strings not updating in Components with OnPush change detection
When I first change the language of my application the translation service makes a request for the file that represents the new language, My 'smart' components strings reflect the update correctly BUT any 'pure/dumb' components do not, they stay in…

HomeBrew
- 849
- 2
- 12
- 25