mirror of
https://github.com/bitwarden/browser
synced 2025-12-22 11:13:46 +00:00
pass utilsService to i18n function
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
export default function i18nService() {
|
||||
import UtilsService from '../services/utils.service';
|
||||
|
||||
export default function i18nService(utilsService: UtilsService) {
|
||||
const edgeMessages: any = {};
|
||||
|
||||
if (navigator.userAgent.indexOf(' Edge/') !== -1) {
|
||||
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);
|
||||
}
|
||||
if (utilsService.isEdge()) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return edgeMessages;
|
||||
}
|
||||
@@ -22,8 +22,6 @@ export default function i18nService() {
|
||||
return chrome.i18n.getMessage(name);
|
||||
},
|
||||
set(target, name, value) {
|
||||
throw new Error('set not allowed for i18n');
|
||||
// @ts-ignore: Unreachable code error
|
||||
return false;
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user