2018-06-05 21:02:53 +02:00
|
|
|
import { I18nService as BaseI18nService } from 'jslib/services/i18n.service';
|
|
|
|
|
|
|
|
export class I18nService extends BaseI18nService {
|
|
|
|
constructor(systemLanguage: string, localesDirectory: string) {
|
|
|
|
super(systemLanguage, localesDirectory, async (formattedLocale: string) => {
|
2018-06-11 15:37:29 +02:00
|
|
|
const filePath = this.localesDirectory + '/' + formattedLocale + '/messages.json?cache=' +
|
|
|
|
process.env.CACHE_TAG;
|
2018-06-05 21:02:53 +02:00
|
|
|
const localesResult = await fetch(filePath);
|
|
|
|
const locales = await localesResult.json();
|
|
|
|
return locales;
|
|
|
|
});
|
|
|
|
|
|
|
|
this.supportedTranslationLocales = [
|
|
|
|
'en', 'es',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|