Internationalization and localization

When we have to build a global application that touches the lives of people from different corners of the world, then we have to think about many aspects such as internationalization and localization. We will be integrating this inside our e-commerce app so that we can add multiple language support.

We will start by installing the ng2-translate npm module:

npm install ng2-translate --save

Next, we will import the modules and methods used inside app.module.ts:

// /src/app/app.module.tsimport { TranslateModule, TranslateLoader, TranslateStaticLoader } from 'ng2-translate/ng2-translate'; export function createTranslateLoader(http: Http) {  return new TranslateStaticLoader(http, './assets/i18n', '.json'); ...

Get Hybrid Mobile Development with Ionic now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.