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.
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…
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…
I want to get current language with this.translate.getBrowserLang(), but it always return 'en', whatever the current language is and what the supported languages is.
Here is the plnkr: https://plnkr.co/edit/JEXgj8WcISYGtDg75VoR?p=preview,
maybe…
There are multiple methode to translate an (Angular) app, the big main methodes are :
ngx-translate
and
Angular 2 native i18n
As far I understood i18n is easier for SEO because of the clean url browsing with
e.g
app.com/de
app.com/en
on the other…
I am trying to make a method which would accept string key and return translated string value by using translate.instant(parameter). The problem is that it returns key(parameter). Usually this is returned if it doesn't find translation. I think the…
I'm using ngx-translate.
How can I put a line break in a string to translate ?
In my template I have :
{{'STRING_TO_TRANSLATE' | translate}}
In my en.json:
{
"STRING_TO_TRANSLATE": "text on first line. or \n don't work. Text on second…
Probably one of the most common questions, while the documentation and some other questions I found try to clear up things for me, yet I am still not sure how to fix this.
So this is my structure:
App module is of course the main module that is…
I've got an application which uses this library. How do I test components with it? I DO NOT WANT TO TEST THE LIBRARY. I just need to start tests of my component without multiple errors about TranslateModule then TranslateService then TranslateStore…
I've read i18n runtime support is coming in angular 6, but cant find anything in rc3. Is it postponed or not yet documented? The i18n documentation still states than one have to build a separate build for each…
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) {
…
I've downloaded the package ngx-translate/core, and been following the documentation instructions.
I can't get the translation to work.
The steps i made:
1] define everything in the AppModule
import { BrowserModule } from…
I am trying to build an application with Angular 6 and I am still setting everything up. But it seems there is something wrong with the dependency injection in my app.
It cannot resolve any constructor parameter. They all result in Uncaught Error:…
I'm using ngx-translate with no-problems in views, using pipes. What i need to do is to use it in a component, for example to show an error message, or define a datatable column default content.
I'm trying to do something…
I'm using @ngx-translate for language handling in an Angular 5 app I'm creating. The app has two feature modules, one lazy loaded and one eager loaded.
The problem is that the translate pipe works fine in the eager-loaded module but not the…