Skip to content

Commit bfe678e

Browse files
committed
Localize user-facing container-related messages
1 parent 0b791f1 commit bfe678e

File tree

5 files changed

+35
-11
lines changed

5 files changed

+35
-11
lines changed

src/_locales/en/messages.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,30 @@
823823
"TabGuard_optAllow": {
824824
"message": "Load normally"
825825
},
826+
"DefaultContainerName": {
827+
"message": "Default"
828+
},
829+
"enable_container_tabs_label": {
830+
"message": "Enable support for container tabs"
831+
},
832+
"select_container_label": {
833+
"message": "Choose a container:"
834+
},
835+
"copy_container_label": {
836+
"message": "Copy permissions from container:"
837+
},
838+
"clear_container_label": {
839+
"message": "Clear permissions for this container"
840+
},
841+
"forbid_replace_default_policy": {
842+
"message": "Cannot replace the default policy."
843+
},
844+
"container_copy_warning": {
845+
"message": "Copying permissions from \"$1\".\nAll site permissions for this container will be removed.\nThis action cannot be reverted.\nDo you want to continue?"
846+
},
847+
"container_clear_warning": {
848+
"message": "All site permissions for this container will be removed.\nThis action cannot be reverted.\nDo you want to continue?"
849+
},
826850
"LearnMoreLink": {
827851
"message": "Learn more…"
828852
},

src/ui/options.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h3 class="flextabs__tab"><button class="flextabs__toggle">__MSG_SectionGeneral_
5656
<input type="checkbox" id="opt-enforceOnRestart"><label for="opt-enforceOnRestart" id="lbl-enforceOnRestart">__MSG_EnforceOnRestart__</label>
5757
</span>
5858
<span id="containers-opt">
59-
<input type="checkbox" class="enforcement_required" id="opt-containers"><label for="opt-containers" id="lbl-containers">Enable support for container tabs</label>
59+
<input type="checkbox" class="enforcement_required" id="opt-containers"><label for="opt-containers" id="lbl-containers">__MSG_enable_container_tabs_label__</label>
6060
</span>
6161
</div>
6262
<div class="opt-group not-tor">
@@ -88,9 +88,9 @@ <h3 class="flextabs__tab"><button class="flextabs__toggle">__MSG_SectionGeneral_
8888

8989
<h3 class="flextabs__tab"><button class="flextabs__toggle enforcement_required">__MSG_SectionSitePermissions__</button></h3>
9090
<div class="flextabs__content">
91-
<label for="select-container" id="select-container-label">Choose a container:</label>
91+
<label for="select-container" id="select-container-label">__MSG_select_container_label__</label>
9292
<select name="select-container" id="select-container">
93-
<option value="default">Default</option>
93+
<option value="default">__MSG_DefaultContainerName__</option>
9494
</select>
9595
<section class="sect-sites">
9696
<form id="form-newsite" class="browser-style" >
@@ -103,13 +103,13 @@ <h3 class="flextabs__tab"><button class="flextabs__toggle enforcement_required">
103103
</div>
104104
</div>
105105
<div class="per-site-buttons" id="per-site-buttons">
106-
<label for="copy-container" id="copy-container-label">Copy permissions from container:</label>
106+
<label for="copy-container" id="copy-container-label">__MSG_copy_container_label__</label>
107107
<select name="copy-container" id="copy-container">
108108
<option value=blank></option>
109-
<option value="default">Default</option>
109+
<option value="default">__MSG_DefaultContainerName__</option>
110110
</select>
111111
<div style="inline-size:0;margin-inline:.5em;border:1px solid #888"></div>
112-
<button id="btn-clear-container">Clear permissions for this container</button>
112+
<button id="btn-clear-container">__MSG_clear_container_label__</button>
113113
</div>
114114
</section>
115115
</div>

src/ui/options.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,14 @@ document.querySelector("#version").textContent = _("Version",
246246
async function copyContainer() {
247247
cookieStoreId = containerSelect.value;
248248
if (cookieStoreId == "default") {
249-
alert("Cannot replace the default policy.")
249+
alert(_("forbid_replace_default_policy"))
250250
containerCopy.value = "blank";
251251
return;
252252
}
253253
let copyCookieStoreId = containerCopy.value;
254254
let copyContainerName = containerCopy.options[containerCopy.selectedIndex].text;
255255
let copyPolicy = await UI.getPolicy(copyCookieStoreId);
256-
if (confirm(`Copying permissions from "${copyContainerName}".\n` + "All site permissions for this container will be removed.\nThis action cannot be reverted.\nDo you want to continue?")) {
256+
if (confirm(_("container_copy_warning", copyContainerName))) {
257257
sitesUI.clear()
258258
currentPolicy = await UI.replacePolicy(cookieStoreId, new Policy(copyPolicy.dry(true)));
259259
await UI.updateSettings({policy, contextStore});
@@ -333,7 +333,7 @@ document.querySelector("#version").textContent = _("Version",
333333
}, true);
334334

335335
document.querySelector("#btn-clear-container").addEventListener("click", async ev => {
336-
if (confirm("All site permissions for this container will be removed.\nThis action cannot be reverted.\nDo you want to continue?")) {
336+
if (confirm(_("container_clear_warning"))) {
337337
sitesUI.clear()
338338
currentPolicy.sites = Sites.hydrate({});
339339
await UI.updateSettings({policy, contextStore});

src/ui/popup.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<a class="hider-close">×</a>
3535
</div>
3636
<div class="spacer"></div>
37-
<div id="container-id" class="container-id">Default</div>
37+
<div id="container-id" class="container-id">__MSG_DefaultContainerName__</div>
3838
<button aria-role="button" id="enforce" class="toggle icon"></button>
3939
<button aria-role="button" id="enforce-tab" class="toggle icon"></button>
4040
<button aria-role="button" id="temp-trust-page" class="toggle icon" title="__MSG_TempTrustPage__"></button>

src/ui/popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ addEventListener("unload", e => {
193193
document.querySelector("#container-id").textContent = containerName;
194194
debug("found container name", containerName, "for cookieStoreId", cookieStoreId);
195195
} catch(err) {
196-
document.querySelector("#container-id").textContent = "Default";
196+
document.querySelector("#container-id").textContent = _("DefaultContainerName");
197197
debug("no container for cookieStoreId", cookieStoreId, "error:", err.message);
198198
}
199199
} else {

0 commit comments

Comments
 (0)