[gnome-shell-extensions/gnome-40] extensions: Pick up gettext domain from metadata



commit 1d3775b3d10f28b02c4fca55f94ab1fca9161946
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Aug 6 04:17:46 2021 +0200

    extensions: Pick up gettext domain from metadata
    
    Since commit a6ee142f211, the extension archives that are uploaded
    to extensions.gnome.org only contain strings that are relevant for
    the extension, not all translations from all extensions.
    
    Unfortunately all extensions still share a common gettext domain,
    so the extension with the last bind_textdomain() call wins and
    leaves the others without translations.
    
    We'll address this by using distinct domains when not installed
    system-wide. That becomes easier if there is a canonical place
    for the text domain, with the existing metadata key being the
    natural choice.
    
    https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/335
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/179>

 extensions/.lock                             | 0
 extensions/apps-menu/extension.js            | 3 ++-
 extensions/auto-move-windows/prefs.js        | 7 ++++---
 extensions/drive-menu/extension.js           | 7 ++++---
 extensions/places-menu/extension.js          | 5 +++--
 extensions/places-menu/placeDisplay.js       | 5 ++++-
 extensions/window-list/extension.js          | 2 +-
 extensions/window-list/prefs.js              | 7 ++++---
 extensions/window-list/workspaceIndicator.js | 5 ++++-
 extensions/workspace-indicator/extension.js  | 4 +++-
 extensions/workspace-indicator/prefs.js      | 7 ++++---
 11 files changed, 33 insertions(+), 19 deletions(-)
---
diff --git a/extensions/.lock b/extensions/.lock
new file mode 100644
index 0000000..e69de29
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 6376b52..e36b0fe 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -12,7 +12,8 @@ const Main = imports.ui.main;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 
-const Gettext = imports.gettext.domain('gnome-shell-extensions');
+const Me = ExtensionUtils.getCurrentExtension();
+const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
 const _ = Gettext.gettext;
 
 const appSys = Shell.AppSystem.get_default();
diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js
index c550458..2c52906 100644
--- a/extensions/auto-move-windows/prefs.js
+++ b/extensions/auto-move-windows/prefs.js
@@ -4,10 +4,11 @@
 
 const { Gio, GLib, GObject, Gtk, Pango } = imports.gi;
 
-const Gettext = imports.gettext.domain('gnome-shell-extensions');
-const _ = Gettext.gettext;
-
 const ExtensionUtils = imports.misc.extensionUtils;
+const Me = ExtensionUtils.getCurrentExtension();
+
+const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
+const _ = Gettext.gettext;
 
 const SETTINGS_KEY = 'application-list';
 
diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js
index f60dab7..fd3a921 100644
--- a/extensions/drive-menu/extension.js
+++ b/extensions/drive-menu/extension.js
@@ -2,15 +2,16 @@
 // Drive menu extension
 const { Clutter, Gio, GObject, Shell, St } = imports.gi;
 
-const Gettext = imports.gettext.domain('gnome-shell-extensions');
-const _ = Gettext.gettext;
-
 const ExtensionUtils = imports.misc.extensionUtils;
 const Main = imports.ui.main;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 const ShellMountOperation = imports.ui.shellMountOperation;
 
+const Me = ExtensionUtils.getCurrentExtension();
+const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
+const _ = Gettext.gettext;
+
 var MountMenuItem = GObject.registerClass(
 class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
     _init(mount) {
diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js
index 53663fc..e3b04d6 100644
--- a/extensions/places-menu/extension.js
+++ b/extensions/places-menu/extension.js
@@ -8,11 +8,12 @@ const Main = imports.ui.main;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 
-const Gettext = imports.gettext.domain('gnome-shell-extensions');
+const Me = ExtensionUtils.getCurrentExtension();
+
+const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
 const _ = Gettext.gettext;
 const N_ = x => x;
 
-const Me = ExtensionUtils.getCurrentExtension();
 const PlaceDisplay = Me.imports.placeDisplay;
 
 const PLACE_ICON_SIZE = 16;
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index bb78d5e..d2afc1e 100644
--- a/extensions/places-menu/placeDisplay.js
+++ b/extensions/places-menu/placeDisplay.js
@@ -3,10 +3,13 @@
 const { Gio, GLib, Shell } = imports.gi;
 const Signals = imports.signals;
 
+const ExtensionUtils = imports.misc.extensionUtils;
 const Main = imports.ui.main;
 const ShellMountOperation = imports.ui.shellMountOperation;
 
-const Gettext = imports.gettext.domain('gnome-shell-extensions');
+const Me = ExtensionUtils.getCurrentExtension();
+
+const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
 const _ = Gettext.gettext;
 const N_ = x => x;
 
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index 4802f9e..f7ecd19 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -11,7 +11,7 @@ const Me = ExtensionUtils.getCurrentExtension();
 const { WindowPicker, WindowPickerToggle } = Me.imports.windowPicker;
 const { WorkspaceIndicator } = Me.imports.workspaceIndicator;
 
-const Gettext = imports.gettext.domain('gnome-shell-extensions');
+const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
 const _ = Gettext.gettext;
 
 const ICON_TEXTURE_SIZE = 24;
diff --git a/extensions/window-list/prefs.js b/extensions/window-list/prefs.js
index 217c222..aec8cc9 100644
--- a/extensions/window-list/prefs.js
+++ b/extensions/window-list/prefs.js
@@ -3,10 +3,11 @@
 
 const { Gio, GObject, Gtk } = imports.gi;
 
-const Gettext = imports.gettext.domain('gnome-shell-extensions');
-const _ = Gettext.gettext;
-
 const ExtensionUtils = imports.misc.extensionUtils;
+const Me = ExtensionUtils.getCurrentExtension();
+
+const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
+const _ = Gettext.gettext;
 
 
 function init() {
diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js
index c35e37a..cdfe5b6 100644
--- a/extensions/window-list/workspaceIndicator.js
+++ b/extensions/window-list/workspaceIndicator.js
@@ -2,11 +2,14 @@
 const { Clutter, Gio, GObject, Meta, St } = imports.gi;
 
 const DND = imports.ui.dnd;
+const ExtensionUtils = imports.misc.extensionUtils;
 const Main = imports.ui.main;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 
-const Gettext = imports.gettext.domain('gnome-shell-extensions');
+const Me = ExtensionUtils.getCurrentExtension();
+
+const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
 const _ = Gettext.gettext;
 
 const TOOLTIP_OFFSET = 6;
diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js
index b79af93..6974062 100644
--- a/extensions/workspace-indicator/extension.js
+++ b/extensions/workspace-indicator/extension.js
@@ -9,7 +9,9 @@ const Main = imports.ui.main;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 
-const Gettext = imports.gettext.domain('gnome-shell-extensions');
+const Me = ExtensionUtils.getCurrentExtension();
+
+const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
 const _ = Gettext.gettext;
 
 const WORKSPACE_SCHEMA = 'org.gnome.desktop.wm.preferences';
diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js
index d45d1e8..567f3e9 100644
--- a/extensions/workspace-indicator/prefs.js
+++ b/extensions/workspace-indicator/prefs.js
@@ -3,12 +3,13 @@
 
 const { Gio, GLib, GObject, Gtk, Pango } = imports.gi;
 
-const Gettext = imports.gettext.domain('gnome-shell-extensions');
+const ExtensionUtils = imports.misc.extensionUtils;
+const Me = ExtensionUtils.getCurrentExtension();
+
+const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
 const _ = Gettext.gettext;
 const N_ = e => e;
 
-const ExtensionUtils = imports.misc.extensionUtils;
-
 const WORKSPACE_SCHEMA = 'org.gnome.desktop.wm.preferences';
 const WORKSPACE_KEY = 'workspace-names';
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]