O'Reilly logo

Hands-On Full Stack Web Development with Aurelia by Erikson Haziz Murrugarra Sifuentes, Diego Jose Arguelles Rojas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the plugin – Multilanguage support!

To start using our files, you must tell your ViewModel components which language to use. We will perform this operation at constructor method; check out this example:

import {I18N} from 'aurelia-i18n';import { inject } from 'aurelia-dependency-injection';@inject(I18n) export class WelcomePageComponent { constructor(i18n) { this.i18n = i18n; this.i18n .setLocale('es-ES') .then( () => {}); } ... }

What if you want to get the active locale? Easy, change the configuration file to look like this:

import {I18N} from 'aurelia-i18n';
@inject(I18n)
export class WelcomePageComponent {
     constructor(i18n) {
       this.i18n = i18n;
     }
      ...
}

Similar to setLocale(), we have the getLocale() method. You can retrieve the active ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required