1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-19 07:35:48 +02:00
bitwarden-browser/src/services/i18n.service.ts

29 lines
800 B
TypeScript
Raw Normal View History

import { Abstractions } from '@bitwarden/jslib';
2017-12-06 20:05:49 +01:00
export default function i18nService(platformUtilsService: Abstractions.PlatformUtilsService) {
const edgeMessages: any = {};
2018-01-05 22:30:15 +01:00
if (platformUtilsService.isEdge()) {
2017-12-06 20:05:49 +01:00
fetch('../_locales/en/messages.json').then((file) => {
return file.json();
}).then((locales) => {
for (const prop in locales) {
if (locales.hasOwnProperty(prop)) {
edgeMessages[prop] = chrome.i18n.getMessage(prop);
}
2017-12-06 20:05:49 +01:00
}
});
return edgeMessages;
}
return new Proxy({}, {
get: (target, name) => {
return chrome.i18n.getMessage(name);
},
set: (target, name, value) => {
return false;
},
});
}