Questions tagged [ngx-translate]

NGX-Translate is an internationalization library for Angular 2+. It lets you define translations for your content in different languages and switch between them easily.

Resources:

  1. Website: http://www.ngx-translate.com/
  2. Github: https://github.com/ngx-translate
  3. Demo: https://stackblitz.com/github/ngx-translate/example
716 questions
14
votes
2 answers

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

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 {…
Adnan Senyurt
  • 177
  • 1
  • 2
  • 6
12
votes
1 answer

i18n Translate.instant with parameters

I need to use TranslateService.instant from ngx-core and pass parameters to do string interpolation. So far I've done: MY_STRING: "Welcome {{user}}" In my component I do: translateService.instant(MY_STRING, {user: 'Nick'}) and what I get from this…
Usr
  • 2,628
  • 10
  • 51
  • 91
12
votes
0 answers

ngx-translate - merge translation file of different modules

I use angular-cli in my project with @ngx-translate. The application has lazy-loaded modules and one shared-module (not lazy-loaded) with components. The language files are separated per modules. The problem is when I use a shared component in a…
devMiller
  • 121
  • 1
  • 4
12
votes
2 answers

Angular translate service, interpolate params in nested json

In angular translation service, interpolating params in normal translation json works well. But in nested json, interpolating params is not working. My JSON: "SampleField": { "SampleValidation": { "MIN": "Value should not be less than…
Aqeel Ashiq
  • 1,988
  • 5
  • 24
  • 57
11
votes
2 answers

ngx-translate default text if key is missing or translation file is being loaded

I'm setting up a new Angular 7 app. I want to set a default text for translation. So in the translation {{ 'wait' | translate }}, I want to set text 'Waiting Now' as default text if there are any fallback. Means if data is being loaded or key is…
Sushil Kumar Gupta
  • 180
  • 1
  • 1
  • 10
11
votes
3 answers

Angular 4 Ngx-translate pipe not working

I want to make an angular 4 app that is multilangual. I have followed the answer on Angular 2 - Multilingual Support but it doesn't work. I did every step, from 1 to 5 on that page and my appmodule looks the same. I have a file en.json in a folder…
fangio
  • 1,746
  • 5
  • 28
  • 52
10
votes
1 answer

ngx-translate using a variable as a parameter in Angular 7

I'm having an issue with NGX-Translate in Angular7. I'm trying to translate a phrase with a parameter. If the parameter is hardcoded, it works, but if the parameter is a variable it doesn't. app.component.ts import { Component, OnInit } from…
John McArthur
  • 916
  • 1
  • 12
  • 30
10
votes
4 answers

apply bold text on part of string Angular

I would like to make a part of my text bold. I get a text from a specific file. "INFORMATION": "Here's an example of text", I would want that Here's an to be bold. "INFORMATION": "Here's an example of text", "INFORMATION": "Here's…
Hamza Haddad
  • 1,516
  • 6
  • 28
  • 48
10
votes
3 answers

Angular - ngx-translate - Checking if translate key exist with Angular

I use ngx-translate in my Angular application. My HTML template: {{ 'ADMIN.USER.ROLES.' + role | translate }} My i18n json file: "ADMIN": { "USER": { …
Stéphane GRILLON
  • 11,140
  • 10
  • 85
  • 154
10
votes
4 answers

Custom Angular library with ngx-translate

I've created my own private angular library with multiple components to make my life easier. I made this library by following this tutorial. Everything worked out great I even added it to another project to test it out. Now comes the part where I…
Beejee
  • 1,836
  • 2
  • 17
  • 31
10
votes
1 answer

Ionic3 The pipe 'translate' could not be found

hi it's been days since I've tried to solve this problem without success. When I try to use the pipe translate i get this error Error: Uncaught (in promise): Error: Template parse errors: The pipe 'translate' could not be found ("
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
9
votes
2 answers

ngx-translate not showing any text in lazy-loaded module

We are using Angular 6 in our application. We recently started to prepare our app fro lazy-loading. Application has multiple lazy-loaded routes. We want to use a single language file for all routes (don't need to separate it into chunks. But load…
9
votes
2 answers

Use fetched config in forRoot

I'm writing an angular app which uses @ngx-translate. With TranslateModule.forRoot(...) i provide a TranslateLoader: @NgModule({ imports: [ TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory:…
phylax
  • 2,034
  • 14
  • 13
9
votes
1 answer

Angular / ngx-translate Using separate translation in inner module does not work

What we want to do Use a separate translateLoader that loads it's own translations for a certain module in our app. What we have tried Al lot of different combinations of TranslateModule.forChild/TranslateModule.forRoot, with or without isolate:…
Wilgert
  • 706
  • 1
  • 6
  • 23
1
2
3
47 48