Skip to content

Commit

Permalink
Merge pull request #2543 from dannycolin/i18n-remove-hardcoded-strings
Browse files Browse the repository at this point in the history
Fix missing i18n strings in the UI
  • Loading branch information
dannycolin authored Jun 28, 2023
2 parents dae7d92 + f85d751 commit f20688c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/js/background/assignManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ window.assignManager = {
}
browser.contextMenus.create({
id: menuId,
title: "Always Open in This Container",
title: browser.i18n.getMessage("alwaysOpenSiteInContainer"),
checked,
type: "checkbox",
contexts: ["all"],
Expand All @@ -692,13 +692,13 @@ window.assignManager = {

browser.contextMenus.create({
id: this.MENU_HIDE_ID,
title: "Hide This Container",
title: browser.i18n.getMessage("hideThisContainer"),
contexts: ["all"],
});

browser.contextMenus.create({
id: this.MENU_MOVE_ID,
title: "Move Tabs to a New Window",
title: browser.i18n.getMessage("moveTabsToANewWindow"),
contexts: ["all"],
});
},
Expand Down
15 changes: 15 additions & 0 deletions src/js/background/backgroundLogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const backgroundLogic = {
NUMBER_OF_KEYBOARD_SHORTCUTS: 10,
unhideQueue: [],
init() {

browser.commands.onCommand.addListener(function (command) {
if (command === "sort_tabs") {
backgroundLogic.sortTabs();
Expand All @@ -32,6 +33,20 @@ const backgroundLogic = {

browser.permissions.onAdded.addListener(permissions => this.resetPermissions(permissions));
browser.permissions.onRemoved.addListener(permissions => this.resetPermissions(permissions));

// Update Translation in Manifest
browser.runtime.onInstalled.addListener(this.updateTranslationInManifest);
browser.runtime.onStartup.addListener(this.updateTranslationInManifest);
},

updateTranslationInManifest() {
for (let index = 0; index < 10; index++) {
const ajustedIndex = index + 1; // We want to start from 1 instead of 0 in the UI.
browser.commands.update({
name: `open_container_${index}`,
description: browser.i18n.getMessage("containerShortcut", `${ajustedIndex}`)
});
}
},

resetPermissions(permissions) {
Expand Down
28 changes: 14 additions & 14 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,80 +41,80 @@
"default": "Ctrl+Period",
"mac": "MacCtrl+Period"
},
"description": "Open containers panel"
"description": "__MSG_openContainerPanel__"
},
"sort_tabs": {
"suggested_key": {
"default": "Ctrl+Comma",
"mac": "MacCtrl+Comma"
},
"description": "Sort tabs by container"
"description": "__MSG_sortTabsByContainer__"
},
"open_container_0": {
"suggested_key": {
"default": "Ctrl+Shift+1"
},
"description": "Container Shortcut 1"
"description": "__MSG_containerShortcut__"
},
"open_container_1": {
"suggested_key": {
"default": "Ctrl+Shift+2"
},
"description": "Container Shortcut 2"
"description": "__MSG_containerShortcut__"
},
"open_container_2": {
"suggested_key": {
"default": "Ctrl+Shift+3"
},
"description": "Container Shortcut 3"
"description": "__MSG_containerShortcut__"
},
"open_container_3": {
"suggested_key": {
"default": "Ctrl+Shift+4"
},
"description": "Container Shortcut 4"
"description": "__MSG_containerShortcut__"
},
"open_container_4": {
"suggested_key": {
"default": "Ctrl+Shift+5"
},
"description": "Container Shortcut 5"
"description": "__MSG_containerShortcut__"
},
"open_container_5": {
"suggested_key": {
"default": "Ctrl+Shift+6"
},
"description": "Container Shortcut 6"
"description": "__MSG_containerShortcut__"
},
"open_container_6": {
"suggested_key": {
"default": "Ctrl+Shift+7"
},
"description": "Container Shortcut 7"
"description": "__MSG_containerShortcut__"
},
"open_container_7": {
"suggested_key": {
"default": "Ctrl+Shift+8"
},
"description": "Container Shortcut 8"
"description": "__MSG_containerShortcut__"
},
"open_container_8": {
"suggested_key": {
"default": "Ctrl+Shift+9"
},
"description": "Container Shortcut 9"
"description": "__MSG_containerShortcut__"
},
"open_container_9": {
"suggested_key": {
"default": "Ctrl+Shift+0"
},
"description": "Container Shortcut 10"
"description": "__MSG_containerShortcut__"
}
},
"browser_action": {
"browser_style": true,
"default_icon": "img/multiaccountcontainer-16.svg",
"default_title": "Multi-Account Containers",
"default_title": "Firefox Multi-Account Containers",
"default_popup": "popup.html",
"theme_icons": [
{
Expand All @@ -127,7 +127,7 @@
"page_action": {
"browser_style": true,
"default_icon": "img/container-openin-16.svg",
"default_title": "Always open this in a Container",
"default_title": "__MSG_alwaysOpenSiteInContainer__",
"default_popup": "pageActionPopup.html",
"pinned": false,
"show_matches": ["*://*/*"]
Expand Down
2 changes: 1 addition & 1 deletion src/pageActionPopup.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Multi-Account Containers</title>
<title>Firefox Multi-Account Containers</title>
<script type="text/javascript" src="./js/i18n.js"></script>
<link rel="stylesheet" type="text/css" href="css/popup.css">

Expand Down
6 changes: 3 additions & 3 deletions src/popup.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html data-theme="auto">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Multi-Account Containers</title>
<title>Firefox Multi-Account Containers</title>
<script type="text/javascript" src="./js/i18n.js"></script>
<link rel="stylesheet" href="./css/popup.css">
</head>
Expand Down Expand Up @@ -107,7 +107,7 @@ <h3 class="onboarding-title" data-i18n-message-id="oneHundredTabsHeader"></h3>
</div>

<div class="panel menu-panel container-panel hide" id="container-panel">
<h3 class="title">Multi-Account Containers</h3>
<h3 class="title">Firefox Multi-Account Containers</h3>
<a href="#" class="info-icon" id="info-icon" tabindex="10">
<img data-i18n-attribute-message-id="info" data-i18n-attribute="alt" alt="" src="/img/info.svg" / >
</a>
Expand Down Expand Up @@ -268,7 +268,7 @@ <h3 class="title" id="container-info-title" data-i18n-attribute-message-id="pers

<div class="panel menu-panel container-picker-panel hide" id="container-picker-panel">
<h3 class="title" id="picker-title">
Multi-Account Containers
Firefox Multi-Account Containers
</h3>
<button class="btn-return arrow-left controller keyboard-nav-back" id="close-container-picker-panel" tabindex="0"></button>
<hr>
Expand Down

0 comments on commit f20688c

Please sign in to comment.