[gnome-shell-extensions] cleanup: Use new gettext() convenience



commit cc45bd63ab7dd01241438e2144eec2794583cd5e
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Apr 12 02:53:08 2020 +0200

    cleanup: Use new gettext() convenience
    
    gnome-shell now includes convenience helpers for gettext functions that
    use an extension's text domain (as initialized by initTranslations()).
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/183>

 extensions/apps-menu/extension.js            | 4 +---
 extensions/auto-move-windows/prefs.js        | 4 +---
 extensions/drive-menu/extension.js           | 4 +---
 extensions/places-menu/extension.js          | 6 ++----
 extensions/places-menu/placeDisplay.js       | 5 +----
 extensions/window-list/extension.js          | 3 +--
 extensions/window-list/prefs.js              | 4 +---
 extensions/window-list/workspaceIndicator.js | 5 +----
 extensions/workspace-indicator/extension.js  | 5 +----
 extensions/workspace-indicator/prefs.js      | 4 +---
 10 files changed, 11 insertions(+), 33 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 431328d..fe9d5a2 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -12,9 +12,7 @@ const Main = imports.ui.main;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 
-const Me = ExtensionUtils.getCurrentExtension();
-const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
-const _ = Gettext.gettext;
+const _ = ExtensionUtils.gettext;
 
 const appSys = Shell.AppSystem.get_default();
 
diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js
index 869cdb1..9e303da 100644
--- a/extensions/auto-move-windows/prefs.js
+++ b/extensions/auto-move-windows/prefs.js
@@ -5,10 +5,8 @@
 const { Gio, GLib, GObject, Gtk, Pango } = imports.gi;
 
 const ExtensionUtils = imports.misc.extensionUtils;
-const Me = ExtensionUtils.getCurrentExtension();
 
-const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
-const _ = Gettext.gettext;
+const _ = ExtensionUtils.gettext;
 
 const SETTINGS_KEY = 'application-list';
 
diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js
index 6cc91b2..cc31e77 100644
--- a/extensions/drive-menu/extension.js
+++ b/extensions/drive-menu/extension.js
@@ -8,9 +8,7 @@ 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;
+const _ = ExtensionUtils.gettext;
 
 var MountMenuItem = GObject.registerClass(
 class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js
index 07a83f4..3fe9d9f 100644
--- a/extensions/places-menu/extension.js
+++ b/extensions/places-menu/extension.js
@@ -9,13 +9,11 @@ const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 
 const Me = ExtensionUtils.getCurrentExtension();
+const PlaceDisplay = Me.imports.placeDisplay;
 
-const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
-const _ = Gettext.gettext;
+const _ = ExtensionUtils.gettext;
 const N_ = x => x;
 
-const PlaceDisplay = Me.imports.placeDisplay;
-
 const PLACE_ICON_SIZE = 16;
 
 var PlaceMenuItem = GObject.registerClass(
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index d2afc1e..05b2280 100644
--- a/extensions/places-menu/placeDisplay.js
+++ b/extensions/places-menu/placeDisplay.js
@@ -7,10 +7,7 @@ const ExtensionUtils = imports.misc.extensionUtils;
 const Main = imports.ui.main;
 const ShellMountOperation = imports.ui.shellMountOperation;
 
-const Me = ExtensionUtils.getCurrentExtension();
-
-const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
-const _ = Gettext.gettext;
+const _ = ExtensionUtils.gettext;
 const N_ = x => x;
 
 const BACKGROUND_SCHEMA = 'org.gnome.desktop.background';
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index fe0cb21..56bb829 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -11,8 +11,7 @@ const Me = ExtensionUtils.getCurrentExtension();
 const { WindowPicker, WindowPickerToggle } = Me.imports.windowPicker;
 const { WorkspaceIndicator } = Me.imports.workspaceIndicator;
 
-const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
-const _ = Gettext.gettext;
+const _ = ExtensionUtils.gettext;
 
 const ICON_TEXTURE_SIZE = 24;
 const DND_ACTIVATE_TIMEOUT = 500;
diff --git a/extensions/window-list/prefs.js b/extensions/window-list/prefs.js
index 5f5079c..0dbf7a6 100644
--- a/extensions/window-list/prefs.js
+++ b/extensions/window-list/prefs.js
@@ -4,10 +4,8 @@
 const { Gio, GLib, GObject, Gtk } = imports.gi;
 
 const ExtensionUtils = imports.misc.extensionUtils;
-const Me = ExtensionUtils.getCurrentExtension();
 
-const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
-const _ = Gettext.gettext;
+const _ = ExtensionUtils.gettext;
 
 /** */
 function init() {
diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js
index cdfe5b6..06646cc 100644
--- a/extensions/window-list/workspaceIndicator.js
+++ b/extensions/window-list/workspaceIndicator.js
@@ -7,10 +7,7 @@ const Main = imports.ui.main;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 
-const Me = ExtensionUtils.getCurrentExtension();
-
-const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
-const _ = Gettext.gettext;
+const _ = ExtensionUtils.gettext;
 
 const TOOLTIP_OFFSET = 6;
 const TOOLTIP_ANIMATION_TIME = 150;
diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js
index d8463da..a2c95b6 100644
--- a/extensions/workspace-indicator/extension.js
+++ b/extensions/workspace-indicator/extension.js
@@ -9,10 +9,7 @@ const Main = imports.ui.main;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 
-const Me = ExtensionUtils.getCurrentExtension();
-
-const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
-const _ = Gettext.gettext;
+const _ = ExtensionUtils.gettext;
 
 const WORKSPACE_SCHEMA = 'org.gnome.desktop.wm.preferences';
 const WORKSPACE_KEY = 'workspace-names';
diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js
index e5c5500..807ab7b 100644
--- a/extensions/workspace-indicator/prefs.js
+++ b/extensions/workspace-indicator/prefs.js
@@ -4,10 +4,8 @@
 const { Gio, GLib, GObject, Gtk, Pango } = imports.gi;
 
 const ExtensionUtils = imports.misc.extensionUtils;
-const Me = ExtensionUtils.getCurrentExtension();
 
-const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
-const _ = Gettext.gettext;
+const _ = ExtensionUtils.gettext;
 const N_ = e => e;
 
 const WORKSPACE_SCHEMA = 'org.gnome.desktop.wm.preferences';


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