Ionic Multi Language Tutorial

ionic multi-language support example using ng-translate ( allows you to create ionic projects with multiple language support.


  1. Create New Ionic Project
  2. Install Required dependencies
  3. Create .json files for a different language (here I'm going to use English & Tamil)
  4. Declaring inside app.module.ts
  5. Working with home.html & home.ts

Create New Project

Here, I'm going to create new project called i18. After creation we can serve our project to browser

ionic start i18n blank
cd i18n
ionic serve

Install Required Dependencies

For translation purpose, we are going to use a angular library called ng-translate ( To install ng-translate we need to execute

npm install @ngx-translate/core --save
npm install @ngx-translate/http-loader

Create .json file for languages


{"APPLE": "Apple", "BALL": "Ball", "CAT": "Cat" }


{ "APPLE": "ஆப்பிள்", "BALL": "பந்து", "CAT": "பூனை"}

Declaring inside app.module.ts

import { HttpClientModule, HttpClient } from '@angular/common/http';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
export function createTranslateLoader(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');
  imports: [
      loader: {
        provide: TranslateLoader,
        useFactory: createTranslateLoader,
        deps: [HttpClient]
export class AppModule {}

In above code, we have imported and declared TranslateModule, TranslateLoader, TranslateHttpLoader modules for translation purpose, where these plugin requires http module for requesting .json file, so we also imported and declared HttpClientModule, HttpClient

working with home.html

        <ion-select [(ngModel)]="lang" (ionChange)="switchLanguage()">
            <ion-option value="en">English</ion-option>
            <ion-option value="ta">Tamizh (தமிழ்)</ion-option>

        <h2>{{ 'APPLE' | translate }}</h2>
        <h2>{{ 'BALL' | translate }}</h2>
        <h2>{{ 'CAT' | translate }}</h2>

We created ionic select box to choose languages and we created a list of data to display with translate parameter.

working with home.ts

import { TranslateService } from '@ngx-translate/core';
export class HomePage {
  constructor(public translate: TranslateService) {
    this.lang = 'en';
  switchLanguage() {

In the above code, we have created a translate variable using TranslateService for choosing languages