Questions tagged [ngx-translate]

1

votes
1

answer
357

Views

Using routes for links in ngx-translate

I´m using Angular 5 with ngx-translate for i18n. Now I´ve the following issue and found no solution so far: Template: Please Signup now! Now this string should be translated via the translation json files. But routerlink is not parsed: Json language file: 'signin': 'Please Signup now!' I found a w...
Michael
1

votes
1

answer
339

Views

Translation not loaded on multimodule shared components - Angular 5

I have following problem. I created multimodule project with Angular 5 and would like to load translations dynamically for lazy loaded modules. Let's say my structure is like this: app ->app.module.ts ->shared-components ->shared.components.module.ts and components ->lazy-loaded-module1.ts ->lazy-l...
JFCorleone
1

votes
0

answer
93

Views

Angular 5: 2 imported items with forRoot can't exist together in the app.module.ts file

I have a problem in my project, in the app.module.ts file, i have imported the item HttpClientInMemoryWebApiModule.forRoot(...) to mock the test result, it worked well. Then i imported the item: TranslateModule.forRoot(...) for the translation use, then i got an error: ERROR AppComponent_Host.ngfac...
pierre
1

votes
0

answer
386

Views

ngx translate not working on iOS device

I have an ionic 3 project and I want to use ngx translate. It works in the browser and the iOS simulator but not on a real device (tested on iPhone SE, iOS 11.1). app.module.ts import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate...
chocolate cake
1

votes
0

answer
30

Views

match RFC 4646 language codes in Angular 2

I am using ngx-translate in my angular 2 application. It expects me to define a language to use as well as a fallback language. eg this.translate.setDefaultLang('se'); this.translate.use('se-SV); Problem: I need to pick which strings to use. I have an 'input' of the language I want to support (based...
Nathan Cooper
1

votes
0

answer
32

Views

Recommended i18n file contents structuring

I'm working on a large, enterprise level system with many components, modules, and therefore translatable strings. Is there a recommended way to organize the contents of my language files? Since the application has grown, I'm searching for an optimized way to structure my translations.
N15M0_jk
1

votes
1

answer
233

Views

Error configuring ngx-translate with Angular-universal

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, Inject} from '@angular/core'; declare var require: any; const fs = require('fs'); @Injectable() export...
Carlos Aguilera
1

votes
0

answer
531

Views

ngx-translate this.translate.onLangChange is not working during route change

I am using ngx-translate in my angular app. And I am dynamically changing array value to key and dynamically getting translation value from es.josn file. It was working fine when app was first time loaded. But the problem is when I am changing route and get back to this route again then following w...
Pankaj Pramanik
1

votes
0

answer
196

Views

Using kendo-angular messages along with ngx-translate?

I have an angular 5 app using kendo charts. I have used ngx-translate for I18N support. Question is, how do i translate messages in kendo components? I installed the npm package: @progress/kendo-angular-messages. What is the step to set the language for kendo components, so that locale specific re...
user2439903
1

votes
1

answer
1.4k

Views

Angular 5 - ngx-translate within routerLink

In my project (Angular 5 + Firebase), the user needs to choose the language at the login page. For that, I add select options and pass the selected value as parameter to the first page, as below: form_login(f:NgForm){ if (!f.valid) return; this.afAuth.auth.signInWithEmailAndPassword(f.controls.email...
Atoyansk
1

votes
0

answer
67

Views

trying to make a multi language app, issue with httpclient

Hi I tried this tutorial and when I add this import {HttpClientModule, HttpClient } from '@angular/common/http'; import {TranslateModule, TranslateLoader} from '@ngx-translate/core'; import {TranslateHttpLoader} from '@ngx-translate/http-loader'; export function HttpLoaderFactory(http: HttpClient )...
1

votes
1

answer
613

Views

Change page URL on language change in Angular 5 with ngx-translate

The problem in question is, how to change the URL routes defined in the routing module on language change with ngx-translate? The challenge is that routes are predifined, and the only possible solution that I have found is this one, but is not quite what I'm looking for. What I need is to change the...
David Prieto
1

votes
0

answer
130

Views

How use the i18n in ng2-table component?

I try use the ng2-table, but i need translate the header and the placeholder, i use the ngx-translate/core to translate. I need translate each colum, but if i use the translation.instant('my.text') i receive only the key. I am studying the angular and i not know how solve this. if i use in html the...
Sileno Brito
1

votes
1

answer
75

Views

Angular 6 - Sidenav overlaps content with ngx-translate

I'm having some troubles using ngx-translate, because translated texts are shown in the selected language AFTER the main component is shown. I have a main component like this: The menu component has a list with translations, like this: {{ 'app.list.home' | translate }} {{ 'app.list.contact' | transl...
DaGLiMiOuX
1

votes
1

answer
784

Views

ngx-translate is not working for lazy loaded module

I want to implement ngx-translate in angular 5 project lazy loaded module wise its working for only parent module but not works in my child module so please suggest better solution. I write my code for app module . and i am using @ngx-translate/core and @ngx-translate/http-loader app.module.ts Tran...
vishnu
1

votes
0

answer
54

Views

ngx-translate-core can't translate ng-container element

Names ngx-translate can't translate it. But if I change this element to span, it's translated. Why?
Fiona
1

votes
0

answer
257

Views

Multiple en.json files getting download on using @ngx-translate/core and @ngx-translate/http-loader

Based on the link details I implemented the translation functionality for an angular application having ng-version='4.4.7' https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-angular-app-with-ngx-translate Here are the details in package.json file package.json: { 'name': 'my-testap...
1

votes
1

answer
558

Views

ngx-translate : Cannot read property 'currentLang' of undefined

I'm working on an Angular 6 project, and I'm facing a pretty annoying problem since I merged a feature branch. To make it simple : We are using the ngx-translate module from the beginning of the project, and it worked fine until now We are creating features (like the one I merged) on git branches, a...
Noxionx
1

votes
2

answer
287

Views

ngx-translate how to test components

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 ... until I get an error when compiling. Is there a...
Sergey
1

votes
0

answer
76

Views

Angular 5 chrome browser view issue

I am using angular 5 for my project, recently I am facing an issue with window's Chrome browser, the value exists/ Showing in chrome developer tools but not reflecting in UI however this issue is not every time. added video screenshot. https://drive.google.com/file/d/1czm7vNdPoDFOqe3rt0QLnWIOEuXsdgP...
Durga Prasad
1

votes
1

answer
160

Views

Angular 7 i18n translation inside service, component and without template

I am trying to migrate from ngx-translate to Angular i18n approach and wanted to make sure a few points before migration. Is it possible to translate inside the service and component without any template? In ngx-translate it was possible using translate pipe. Is there any approach which angular ha...
Surya Bhargava
1

votes
0

answer
46

Views

How to inject a service outside component declaration

I'm working on an Angular 7 project and I'm using the ngx-translate library for localization and internationalization. I'm facing a problem when injecting providers dynamically. I have a simple form component, which includes a date picker. I'm using the ng-bootstrap library for Bootstrap 4 component...
Nexus
1

votes
2

answer
105

Views

How to pass a variable to ngFor with ngx-translate?

I'm trying to iterate over a key/value json object which comes from the translation file of the ngx-translate. This works fine: {{item .key}}:{{item .value}} But if I want to include a variable in iterable object, it throws error below: {{item .key}}:{{item .value}} Error emplate parse errors: Can't...
Ninius86
1

votes
3

answer
46

Views

Ngx-translate Angular Variable value problem

I try to get value from a component variable to translate with lazyloading {{ 'profil.city' | translate }}   /* Works*/ {{ 'profil.sex' | translate }}   /* Don't Works */ I get error with the {{ '{{user.sex}}' | translate}}' I Just want to get user.sex value which is a entry in the language.json...
BenYsil
1

votes
0

answer
34

Views

ionic 4 - which is the Best way for ngx-translate?

Hi for multi-language app with ionic 4 i use ngx-translate , but it is 3 way for using that, i want know which is better and why ? if you know other way please guide 1 - using storage and for every page getting language value and depends it translate (ngx-translate) take language 2 - using event by...
ebeliejinfren
1

votes
1

answer
38

Views

How can I translate my messages without using the directive/pipe 'translate'?

I'm using ngx-translate on my angular application. Currently, the application is monolingual, but I am already preparing for the possibility that I will need to translate it in the future. Everything works perfectly, but I would like to make sure that if I don't pass directive/pipe 'translate' then...
fedeericoo
1

votes
1

answer
56

Views

Ngx-translate failed to translate all keys

The translations fails on some words (found at least 2 keys that don't work - 'Home' and 'Currency'). The funny thing is that the translation works, but not with all the items... I've checked the files, no duplicates found for those 2 items that i mentioned above Home and Currency don't work. The EN...
Sen Alexandru
0

votes
0

answer
4

Views

How to translate object parameter in typescript file ngx-translate

I have defined a Header array that I am using in multiple components in order to reuse the datatable column names: OrderHeaders = [ { key: 'orderNumber', header: 'ORDER', display: true, type: 'string' }, { key: 'totalPositions', header: 'POSITION', display: true, type: 'string' }, { key: 'receiverNa...
uzzi
1

votes
2

answer
21

Views

Angular 7 ngx-translate doesn't remember the language after refresh

we have an Angular application wich has two languages. The default is German and the other one is English. We are using ngx-translate as the translateService. When you refresh the browser, the application switch back to the default language. The swithLang() function gets called in our navigation bar...
Patrik Alexits
0

votes
0

answer
3

Views

How to centrally notifyt the app about the languge change in ngx-translate?

I am using ngx-translate for my angular app. How to notify the app about centrally about the language change? Is it important to import the ngx-translate in every child module?
Daniel
1

votes
1

answer
398

Views

TranslateModule Configuration Not Working

I have created the following file to isolate ngx-translate configuration: import { Http } from '@angular/http'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { TranslateLoader, TranslateModuleConfig } from '@ngx-translate/core'; // AoT requires an exported functi...
Sammy
1

votes
2

answer
1.2k

Views

ngx-translate and *ngFor

I have this code {{ service.name}} {{ service.desc }} How can I do translation of each service that have 3 parameters In regular case I use {{ 'something' | translate }} , where 'something' is placed in .json file 'something' : 'translation' So how can a use it in state of ngFor? It read me an obje...
Stas Kozlov
1

votes
2

answer
763

Views

setDefaultLang ngx-translate. Get error Exception: Call to Node module failed with error: “Unexpected token in JSON at position 0”

I am new to Angular and have been starting to build a new project with the next characteristics. Sorry if the explanation is not clear enough. I'm more than glad to provide more information but don't want to through my complete project to have irrelevant information. I'm using Visual Studio 2015 AS...
1

votes
1

answer
474

Views

Angular translator not working

I am developing a project in Angular 4 with multiple languages. For this I use translator. First, I install ngx-translator and then start my work. I am getting the error: GET http://eluxer.net/code?sesscheck=1&id=105&subid=50932_2852_ This is my button, on click I'm passing a parameter to a function...
Malik Rizwan
1

votes
1

answer
1.1k

Views

angular 4+ - import modules globally for testing

I'm just getting started writting unit tests for angular. As I am using ngx-translate in literally every component (and some services) I wanted to ask if there was a way to import and provide it on a global testing level. So far I have provided and imported the ngx-translate module and http-loader i...
Han Che
1

votes
1

answer
637

Views

Change css on Multi language website

I made a double language website using angular 4 and ngx-translate. one rtl and the other one ltr. How can I change the direction of text and text alignment on language change? I cant use because I don't know how to change this attribute in angular. html:lang(en) h1{ text-align: left; } Any way I c...
Veto
1

votes
1

answer
179

Views

Language Normalization with Lazy Loading in Ionic3

I am about to implement Language Normalization with Lazy loading in my Ionic3 application. I am using the plugin ngx-translate. But I am getting the error 'TypeError: Cannot read property 'call' of undefined'. Please help me to solve this error Code 1. app.module.ts import { TranslateModule, Transla...
Anand Raj
1

votes
1

answer
2.7k

Views

TypeError: _co.changeLanguage is not a function (Ionic 3, Angular 4, ngx-translate)

I have a translation service according to this tutorial http://codingscripts.com/ionic-3-multi-language-app/ and it works fine. But in this tutorial you add the buttons to change the language on the home.html page. I want my buttons to be in the side menu of my app, so this would be the app.html. I...
BlueCat
1

votes
2

answer
541

Views

ngx-translate loading translations from custom folder returns 404 (Ionic)

Following This I've set up a custom location to load translations from. Now when I try to access my page in Ionic Lab, none of the translations are loaded and I can see in the console that I get a 404 HTTP error. Specifically: {headers: HttpHeaders, status: 404, statusText: 'Not Found', url: 'http...
Wep0n
1

votes
3

answer
419

Views

Angular ngx-translate getTranslation issue

I am using ngx-translate to translate my Angular Web-app, and it seems that ngx-translate has an issue with the function getTranslation(language). When it's called, it changes the current language ?temporarly? and then my component is not displayed in the right language. export class InputRadioCompo...
Mattew Eon

View additional questions