New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ionic 4] i18n support #15153

Open
vvdwivedi opened this Issue Aug 13, 2018 · 13 comments

Comments

Projects
None yet
8 participants
@vvdwivedi
Copy link

vvdwivedi commented Aug 13, 2018

Ionic angular and i18n support

Angular 6 has this build in i18n support that requires to build different builds for different languages. How is this going to work with ionic 4 app? Is there a way to provide dynamic language switching?

@ionitron-bot ionitron-bot bot added the triage label Aug 13, 2018

@smartifier-salomaa

This comment has been minimized.

Copy link

smartifier-salomaa commented Aug 19, 2018

I have been using http://www.ngx-translate.com (or https://github.com/ngx-translate/core) in my Ionic 4 app and that supports dynamic language switching. You can have one build with multiple language files.

@vvdwivedi

This comment has been minimized.

Copy link

vvdwivedi commented Aug 19, 2018

ngx-translate is there, but I was looking for built in support for translation. I am also using ngx-translate for now.

@Nigdor

This comment has been minimized.

Copy link

Nigdor commented Aug 29, 2018

I'm in the same situation.
Did you find an answer ?
@vvdwivedi

@abhijitdhobale

This comment has been minimized.

Copy link

abhijitdhobale commented Sep 6, 2018

In Ionic 4 is i18n works similar to angular (e.g. i18n-title, i18n-placeholder etc.) with locale file messages.en.xlf?

@yosigolan

This comment has been minimized.

Copy link

yosigolan commented Sep 6, 2018

This was also an issue on ionic 3: #8542
it will be great if this time it will get an answer in version 4.

@Chris1234567899

This comment has been minimized.

Copy link

Chris1234567899 commented Sep 18, 2018

Any news on this?

I tried using ngx-translate meanwhile but I had trouble setting it up. The way it functioned in ionic 3 does not seem to work in ionic 4 anymore. Did someone get it to run already?
Kind of important.

@vvdwivedi

This comment has been minimized.

Copy link

vvdwivedi commented Sep 18, 2018

@Chris1234567899 You can setup ngx-translate just by following the guide on their site. I am using it the same way without any issue. Not sure if ionic is planning to do something about this, but ngx-translate works just fine.

@smartifier-salomaa

This comment has been minimized.

Copy link

smartifier-salomaa commented Sep 18, 2018

I'm using it without any issues. What kind of problems are you having?

I have in app.module.ts

import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';

export function createTranslateLoader(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/', '/translations.json');
}

and then in each page you want to use it

YOUR_PAGE.module.ts
import { TranslateModule } from '@ngx-translate/core';

and

imports: [
 CommonModule,
 FormsModule,
 IonicModule,
 TranslateModule.forChild(),
 RouterModule.forChild(routes)
],

YOUR_PAGE.page.ts
Use it as any other plugin.

@Chris1234567899

This comment has been minimized.

Copy link

Chris1234567899 commented Sep 18, 2018

@vvdwivedi
Thanks, I got it now. No idea what the issue was, after restarting several times ionic serve, it worked.

@tonyawad88

This comment has been minimized.

Copy link

tonyawad88 commented Nov 25, 2018

@vvdwivedi Thank you this helped !

@paulstelzer paulstelzer closed this Dec 3, 2018

@yosigolan

This comment has been minimized.

Copy link

yosigolan commented Dec 4, 2018

Hey.
@paulstelzer why did you closed the issue? does ionic 4 has support for angular i18 framework?

@paulstelzer

This comment has been minimized.

Copy link
Collaborator

paulstelzer commented Dec 4, 2018

Thought it's clear by using ngx-translate. Do you want it at feature? okay, I label it so

@yosigolan

This comment has been minimized.

Copy link

yosigolan commented Dec 4, 2018

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment