Skip to main content

Translations

Translations are handled using the ngx-translate package, with some added tweaks:

  1. A custom json5 loader is used to allow custom anchors in the expanded translation file.
  2. A custom missing translation handler is added to print a warning in console when a translation is not present in the current used language.

This package allows you to translate values using either use the TranslateService, the TranslatePipe or the TranslateDirective.

translateService.getTranslation('space.name').subscribe((res: string) => {
console.log(res);
});

To add languages, you simply add a language.json5 file in the assets/i18n folder. You can toggle between languages using the use method of the TranslationService.

this.translationService.use("en");