1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00
Files
browser/src/services/i18n.service.ts
Oscar Hinton 477066118e Add jslib as a "real" dependency (#321)
* Split jslib

* Bump jslib

* Bump jslib, replace alias with tsconfig-paths-webpack-plugin
2021-06-07 19:25:55 +02:00

20 lines
758 B
TypeScript

import * as fs from 'fs';
import * as path from 'path';
import { I18nService as BaseI18nService } from 'jslib-common/services/i18n.service';
export class I18nService extends BaseI18nService {
constructor(systemLanguage: string, localesDirectory: string) {
super(systemLanguage, localesDirectory, (formattedLocale: string) => {
const filePath = path.join(__dirname, this.localesDirectory + '/' + formattedLocale + '/messages.json');
const localesJson = fs.readFileSync(filePath, 'utf8');
const locales = JSON.parse(localesJson.replace(/^\uFEFF/, '')); // strip the BOM
return Promise.resolve(locales);
});
this.supportedTranslationLocales = [
'en',
];
}
}