applied i18n to background context menus

This commit is contained in:
Kyle Spearrin 2016-10-18 19:03:40 -04:00
parent bfe2edcdea
commit 03e614e58b
5 changed files with 17 additions and 7 deletions

View File

@ -91,6 +91,14 @@
"message": "Copy Username",
"description": "Copy Username"
},
"autoFill": {
"message": "Auto-fill",
"description": "Auto-fill"
},
"generatePasswordCopied": {
"message": "Generate Password (copied)",
"description": "Generate Password (copied)"
},
"autoFillInfo": {
"message": "There are no sites available to auto-fill for the current browser tab.",
"description": "There are no sites available to auto-fill for the current browser tab."

View File

@ -77,21 +77,21 @@ function buildContextMenu() {
type: 'normal',
id: 'autofill',
contexts: ['all'],
title: 'Auto-fill'
title: i18nService.autoFill
});
chrome.contextMenus.create({
type: 'normal',
id: 'copy-username',
contexts: ['all'],
title: 'Copy Username'
title: i18nService.copyUsername
});
chrome.contextMenus.create({
type: 'normal',
id: 'copy-password',
contexts: ['all'],
title: 'Copy Password'
title: i18nService.copyPassword
});
chrome.contextMenus.create({
@ -102,7 +102,7 @@ function buildContextMenu() {
type: 'normal',
id: 'generate-password',
contexts: ['all'],
title: 'Generate Password (copied)'
title: i18nService.generatePasswordCopied
});
}

View File

@ -19,6 +19,8 @@ function i18nService() {
currentTab: chrome.i18n.getMessage("currentTab"),
copyPassword: chrome.i18n.getMessage("copyPassword"),
copyUsername: chrome.i18n.getMessage("copyUsername"),
autoFill: chrome.i18n.getMessage("autoFill"),
generatePasswordCopied: chrome.i18n.getMessage("generatePasswordCopied"),
autoFillInfo: chrome.i18n.getMessage("autoFillInfo"),
addSite: chrome.i18n.getMessage("addSite"),
passwordHint: chrome.i18n.getMessage("passwordHint"),

View File

@ -107,7 +107,7 @@ function initPasswordGenerationService() {
var bits_needed = Math.ceil(Math.log2(range));
if (bits_needed > 53) {
throw new Exception("We cannot generate numbers larger than 53 bits.");
throw new Exception('We cannot generate numbers larger than 53 bits.');
}
var bytes_needed = Math.ceil(bits_needed / 8);
var mask = Math.pow(2, bits_needed) - 1;

View File

@ -11,13 +11,13 @@ function initUtilsService() {
return this.browserCache;
}
if (navigator.userAgent.indexOf("Firefox") !== -1 || navigator.userAgent.indexOf("Gecko/") !== -1) {
if (navigator.userAgent.indexOf('Firefox') !== -1 || navigator.userAgent.indexOf('Gecko/') !== -1) {
this.browserCache = 'firefox';
}
else if ((!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) {
this.browserCache = 'opera';
}
else if (navigator.userAgent.indexOf(" Edge/") !== -1) {
else if (navigator.userAgent.indexOf(' Edge/') !== -1) {
this.browserCache = 'edge';
}
else if (window.chrome) {