bitwarden-desktop/src/services/i18n.service.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
1.5 KiB
TypeScript
Raw Permalink Normal View History

2018-02-09 06:21:00 +01:00
import * as fs from "fs";
2018-01-24 21:22:13 +01:00
import * as path from "path";
import { I18nService as BaseI18nService } from "jslib-common/services/i18n.service";
2018-04-25 14:31:48 +02:00
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);
});
2021-08-19 22:40:33 +02:00
// Please leave 'en' where it is, as it's our fallback language in case no translation can be found
2018-04-25 14:31:48 +02:00
this.supportedTranslationLocales = [
2021-07-11 23:44:40 +02:00
"en",
"af",
"az",
"be",
"bg",
"bn",
"bs",
2021-07-11 23:44:40 +02:00
"ca",
"cs",
"da",
"de",
"el",
"en-GB",
"en-IN",
"eo",
2021-07-11 23:44:40 +02:00
"es",
"et",
"fa",
"fi",
"fil",
2021-07-11 23:44:40 +02:00
"fr",
"he",
"hi",
2021-07-11 23:44:40 +02:00
"hr",
"hu",
"id",
2021-07-06 23:40:17 +02:00
"it",
"ja",
"ka",
"km",
2021-07-06 23:40:17 +02:00
"kn",
"ko",
"lv",
"me",
"ml",
"nb",
"nl",
"nn",
2021-07-06 23:40:17 +02:00
"pl",
"pt-BR",
"pt-PT",
"ro",
"ru",
"si",
2021-07-06 23:40:17 +02:00
"sk",
"sl",
2021-07-06 23:40:17 +02:00
"sr",
"sv",
"th",
"tr",
"uk",
"vi",
"zh-CN",
"zh-TW",
2018-04-25 14:31:48 +02:00
];
2018-01-24 20:59:03 +01:00
}
}