mirror of
https://github.com/zen-browser/desktop.git
synced 2026-07-22 00:21:22 +00:00
gh-10749: Localize command palette actions, emoji picker, etc (gh-14473)
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<hbox id="PanelUI-zen-emojis-picker-pages">
|
||||
<vbox emojis="true">
|
||||
<hbox id="PanelUI-zen-emojis-picker-header">
|
||||
<html:input type="search" id="PanelUI-zen-emojis-picker-search" placeholder="Search emojis" />
|
||||
<html:input type="search" id="PanelUI-zen-emojis-picker-search" data-l10n-id="zen-emojis-picker-search" />
|
||||
</hbox>
|
||||
<hbox id="PanelUI-zen-emojis-picker-list" />
|
||||
</vbox>
|
||||
|
||||
@@ -192,7 +192,7 @@ class nsZenWorkspaceCreation extends MozXULElement {
|
||||
|
||||
this.currentProfile = {
|
||||
id: 0,
|
||||
name: "Default",
|
||||
name: ContextualIdentityService.formatContextLabel("user-context-none"),
|
||||
};
|
||||
} else {
|
||||
this.inputProfile.parentNode.hidden = true;
|
||||
|
||||
@@ -27,6 +27,10 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
UrlUtils: "resource://gre/modules/UrlUtils.sys.mjs",
|
||||
});
|
||||
|
||||
ChromeUtils.defineLazyGetter(lazy, "l10n", () => {
|
||||
return new Localization(["browser/zen-command-palette.ftl"], true);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
lazy,
|
||||
"enabledPref",
|
||||
@@ -182,7 +186,7 @@ export class ZenUrlbarProviderGlobalActions extends UrlbarProvider {
|
||||
.workspaceElement(workspace.uuid)
|
||||
?.style.getPropertyValue("--zen-primary-color");
|
||||
actions.push({
|
||||
label: "Focus on",
|
||||
label: lazy.l10n.formatValueSync("zen-action-focus-on"),
|
||||
extraPayload: {
|
||||
workspaceId: workspace.uuid,
|
||||
prettyName: workspace.name,
|
||||
@@ -215,7 +219,7 @@ export class ZenUrlbarProviderGlobalActions extends UrlbarProvider {
|
||||
.map(addon => {
|
||||
return {
|
||||
icon: "chrome://browser/skin/zen-icons/extension.svg",
|
||||
label: "Extension",
|
||||
label: lazy.l10n.formatValueSync("zen-action-extension"),
|
||||
commandId: `zen:extension-${addon.id}`,
|
||||
extraPayload: {
|
||||
extensionId: addon.id,
|
||||
|
||||
@@ -13,58 +13,62 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||
2
|
||||
);
|
||||
|
||||
ChromeUtils.defineLazyGetter(lazy, "l10n", () => {
|
||||
return new Localization(["browser/zen-command-palette.ftl"], true);
|
||||
});
|
||||
|
||||
function isNotEmptyTab(window) {
|
||||
return !window.gBrowser.selectedTab.hasAttribute("zen-empty-tab");
|
||||
}
|
||||
|
||||
const globalActionsTemplate = [
|
||||
{
|
||||
label: "Toggle Compact Mode",
|
||||
l10nId: "zen-action-toggle-compact-mode",
|
||||
command: "cmd_zenCompactModeToggle",
|
||||
icon: "chrome://browser/skin/zen-icons/sidebar.svg",
|
||||
},
|
||||
{
|
||||
label: "Open Theme Picker",
|
||||
l10nId: "zen-action-open-theme-picker",
|
||||
command: "cmd_zenOpenZenThemePicker",
|
||||
icon: "chrome://browser/skin/zen-icons/edit-theme.svg",
|
||||
},
|
||||
{
|
||||
label: "New Split View",
|
||||
l10nId: "zen-action-new-split-view",
|
||||
command: "cmd_zenNewEmptySplit",
|
||||
icon: "chrome://browser/skin/zen-icons/split.svg",
|
||||
},
|
||||
{
|
||||
label: "New Folder",
|
||||
l10nId: "zen-action-new-folder",
|
||||
command: "cmd_zenOpenFolderCreation",
|
||||
icon: "chrome://browser/skin/zen-icons/folder.svg",
|
||||
},
|
||||
{
|
||||
label: "Copy Current URL",
|
||||
l10nId: "zen-action-copy-current-url",
|
||||
command: "cmd_zenCopyCurrentURL",
|
||||
icon: "chrome://browser/skin/zen-icons/link.svg",
|
||||
},
|
||||
{
|
||||
label: "Settings",
|
||||
l10nId: "zen-action-settings",
|
||||
command: window => window.openPreferences(),
|
||||
icon: "chrome://browser/skin/zen-icons/settings.svg",
|
||||
},
|
||||
{
|
||||
label: "Open Private Window",
|
||||
l10nId: "zen-action-open-private-window",
|
||||
command: "Tools:PrivateBrowsing",
|
||||
icon: "chrome://browser/skin/zen-icons/private-window.svg",
|
||||
},
|
||||
{
|
||||
label: "Open New Window",
|
||||
l10nId: "zen-action-open-new-window",
|
||||
command: "cmd_newNavigator",
|
||||
icon: "chrome://browser/skin/zen-icons/window.svg",
|
||||
},
|
||||
{
|
||||
label: "New Blank Window",
|
||||
l10nId: "zen-action-new-blank-window",
|
||||
command: "cmd_zenNewNavigatorUnsynced",
|
||||
icon: "chrome://browser/skin/zen-icons/window.svg",
|
||||
},
|
||||
{
|
||||
label: "Pin Tab",
|
||||
l10nId: "zen-action-pin-tab",
|
||||
command: "cmd_zenTogglePinTab",
|
||||
icon: "chrome://browser/skin/zen-icons/pin.svg",
|
||||
isAvailable: window => {
|
||||
@@ -73,7 +77,7 @@ const globalActionsTemplate = [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Unpin Tab",
|
||||
l10nId: "zen-action-unpin-tab",
|
||||
command: "cmd_zenTogglePinTab",
|
||||
icon: "chrome://browser/skin/zen-icons/unpin.svg",
|
||||
isAvailable: window => {
|
||||
@@ -82,12 +86,12 @@ const globalActionsTemplate = [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Open Space Routing",
|
||||
l10nId: "zen-action-open-space-routing",
|
||||
command: "cmd_zenOpenSpaceRoutingSettings",
|
||||
icon: "chrome://browser/skin/zen-icons/selectable/airplane.svg",
|
||||
},
|
||||
{
|
||||
label: "New Boost",
|
||||
l10nId: "zen-action-new-boost",
|
||||
icon: "chrome://browser/skin/zen-icons/boost.svg",
|
||||
isAvailable: window => {
|
||||
if (!isNotEmptyTab(window)) {
|
||||
@@ -130,7 +134,7 @@ const globalActionsTemplate = [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Next Space",
|
||||
l10nId: "zen-action-next-space",
|
||||
command: "cmd_zenWorkspaceForward",
|
||||
icon: "chrome://browser/skin/zen-icons/forward.svg",
|
||||
isAvailable: window => {
|
||||
@@ -138,7 +142,7 @@ const globalActionsTemplate = [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Previous Space",
|
||||
l10nId: "zen-action-previous-space",
|
||||
command: "cmd_zenWorkspaceBackward",
|
||||
icon: "chrome://browser/skin/zen-icons/back.svg",
|
||||
isAvailable: window => {
|
||||
@@ -147,7 +151,7 @@ const globalActionsTemplate = [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Close Tab",
|
||||
l10nId: "zen-action-close-tab",
|
||||
command: "cmd_close",
|
||||
icon: "chrome://browser/skin/zen-icons/close.svg",
|
||||
isAvailable: window => {
|
||||
@@ -155,27 +159,27 @@ const globalActionsTemplate = [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Reload Tab",
|
||||
l10nId: "zen-action-reload-tab",
|
||||
command: "Browser:Reload",
|
||||
icon: "chrome://browser/skin/zen-icons/reload.svg",
|
||||
},
|
||||
{
|
||||
label: "Reload Tab Without Cache",
|
||||
l10nId: "zen-action-reload-tab-without-cache",
|
||||
command: "Browser:ReloadSkipCache",
|
||||
icon: "chrome://browser/skin/zen-icons/reload.svg",
|
||||
},
|
||||
{
|
||||
label: "Next Tab",
|
||||
l10nId: "zen-action-next-tab",
|
||||
command: "Browser:NextTab",
|
||||
icon: "chrome://browser/skin/zen-icons/forward.svg",
|
||||
},
|
||||
{
|
||||
label: "Previous Tab",
|
||||
l10nId: "zen-action-previous-tab",
|
||||
command: "Browser:PrevTab",
|
||||
icon: "chrome://browser/skin/zen-icons/back.svg",
|
||||
},
|
||||
{
|
||||
label: "Capture Screenshot",
|
||||
l10nId: "zen-action-capture-screenshot",
|
||||
command: "Browser:Screenshot",
|
||||
icon: "chrome://browser/skin/zen-icons/screenshot.svg",
|
||||
isAvailable: window => {
|
||||
@@ -183,12 +187,12 @@ const globalActionsTemplate = [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Toggle Tabs on right",
|
||||
l10nId: "zen-action-toggle-tabs-on-right",
|
||||
command: "cmd_zenToggleTabsOnRight",
|
||||
icon: "chrome://browser/skin/zen-icons/sidebars-right.svg",
|
||||
},
|
||||
{
|
||||
label: "Add to Essentials",
|
||||
l10nId: "zen-action-add-to-essentials",
|
||||
command: window =>
|
||||
window.gZenPinnedTabManager.addToEssentials(window.gBrowser.selectedTab),
|
||||
isAvailable: window => {
|
||||
@@ -201,7 +205,7 @@ const globalActionsTemplate = [
|
||||
icon: "chrome://browser/skin/zen-icons/essential-add.svg",
|
||||
},
|
||||
{
|
||||
label: "Remove from Essentials",
|
||||
l10nId: "zen-action-remove-from-essentials",
|
||||
command: window =>
|
||||
window.gZenPinnedTabManager.removeEssentials(window.gBrowser.selectedTab),
|
||||
isAvailable: window =>
|
||||
@@ -209,7 +213,7 @@ const globalActionsTemplate = [
|
||||
icon: "chrome://browser/skin/zen-icons/essential-remove.svg",
|
||||
},
|
||||
{
|
||||
label: "Find in Page",
|
||||
l10nId: "zen-action-find-in-page",
|
||||
command: "cmd_find",
|
||||
icon: "chrome://browser/skin/zen-icons/search-page.svg",
|
||||
isAvailable: window => {
|
||||
@@ -217,12 +221,12 @@ const globalActionsTemplate = [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Manage Extensions",
|
||||
l10nId: "zen-action-manage-extensions",
|
||||
command: "Tools:Addons",
|
||||
icon: "chrome://browser/skin/zen-icons/extension.svg",
|
||||
},
|
||||
{
|
||||
label: "Switch to Automatic Appearance",
|
||||
l10nId: "zen-action-switch-to-automatic-appearance",
|
||||
command: () => Services.prefs.setIntPref("zen.view.window.scheme", 2),
|
||||
icon: "chrome://browser/skin/zen-icons/sparkles.svg",
|
||||
isAvailable: () => {
|
||||
@@ -230,7 +234,7 @@ const globalActionsTemplate = [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Switch to Light Mode",
|
||||
l10nId: "zen-action-switch-to-light-mode",
|
||||
command: () => Services.prefs.setIntPref("zen.view.window.scheme", 1),
|
||||
icon: "chrome://browser/skin/zen-icons/face-sun.svg",
|
||||
isAvailable: () => {
|
||||
@@ -238,7 +242,7 @@ const globalActionsTemplate = [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Switch to Dark Mode",
|
||||
l10nId: "zen-action-switch-to-dark-mode",
|
||||
command: () => Services.prefs.setIntPref("zen.view.window.scheme", 0),
|
||||
icon: "chrome://browser/skin/zen-icons/moon-stars.svg",
|
||||
isAvailable: () => {
|
||||
@@ -246,7 +250,7 @@ const globalActionsTemplate = [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Print",
|
||||
l10nId: "zen-action-print",
|
||||
command: "cmd_print",
|
||||
icon: "chrome://browser/skin/zen-icons/print.svg",
|
||||
isAvailable: window => {
|
||||
@@ -266,7 +270,10 @@ export const globalActions = globalActionsTemplate.map(action => ({
|
||||
commandId:
|
||||
typeof action.command === "string"
|
||||
? action.command
|
||||
: `zen:global-action-${action.label.toLowerCase().replace(/\s+/g, "-")}`,
|
||||
: `zen:global-action-${action.l10nId.replace("zen-action-", "")}`,
|
||||
extraPayload: {},
|
||||
...action,
|
||||
get label() {
|
||||
return lazy.l10n.formatValueSync(action.l10nId);
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user