I want to build a web-application with angular2 and bundle this with webpack. What is the best way for providing multiple languages:
i18n-plugin: https://github.com/
I got it working with webpack using the cookbook. The xliff file has to be converted to ts like so:
export const TRANSLATION_SV = `
Category
Kategori
`;
Then in the main.ts it has to be added
import { TRANSLATIONS, TRANSLATIONS_FORMAT, LOCALE_ID } from '@angular/core';
import { TRANSLATION_SV } from './locale/messages.sv';
and inserted to the bootstrap step:
platformBrowserDynamic().bootstrapModule(AppModule, {
providers: [
{provide: TRANSLATIONS, useValue: TRANSLATION_SV},
{provide: TRANSLATIONS_FORMAT, useValue: "xlf"},
{provide: LOCALE_ID, useValue:'sv'}
];
});