[gnome-shell-extensions] Make extensions translatable
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] Make extensions translatable
- Date: Mon, 7 Feb 2011 22:09:14 +0000 (UTC)
commit 2962768a6f7dd3fc9373ccf727f52d138e5416cd
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Mon Feb 7 23:06:33 2011 +0100
Make extensions translatable
Introduce a translation domain, gnome-shell-extensions, and use it
in extensions that have user-facing strings, instead of abusing
of translations provided by gnome-shell.
Also includes an example translation for italian, and bump the
required version for xrandr-indicator.
Depends on GNOME bug 621017.
.gitignore | 5 +++
extensions/example/extension.js | 9 ++++-
extensions/xrandr-indicator/extension.js | 6 ++-
extensions/xrandr-indicator/metadata.json.in | 2 +-
po/LINGUAS | 1 +
po/it.po | 42 ++++++++++++++++++++++++++
6 files changed, 60 insertions(+), 5 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 58b7e1b..2e593bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,11 @@ config/
aclocal.m4
autom4te.cache/
m4/
+po/gnome-shell-extensions.pot
po/POTFILES
po/stamp-it
staging/
+
+*~
+*.gmo
+metadata.json
diff --git a/extensions/example/extension.js b/extensions/example/extension.js
index f137ea6..ceeb067 100644
--- a/extensions/example/extension.js
+++ b/extensions/example/extension.js
@@ -2,10 +2,13 @@
const St = imports.gi.St;
const Mainloop = imports.mainloop;
+const Gettext = imports.gettext.domain('gnome-shell-extensions');
+const _ = Gettext.gettext;
+
const Main = imports.ui.main;
function _showHello() {
- let text = new St.Label({ style_class: 'helloworld-label', text: "Hello, world!" });
+ let text = new St.Label({ style_class: 'helloworld-label', text: _("Hello, world!") });
let monitor = global.get_primary_monitor();
global.stage.add_actor(text);
text.set_position(Math.floor (monitor.width / 2 - text.width / 2), Math.floor(monitor.height / 2 - text.height / 2));
@@ -13,7 +16,9 @@ function _showHello() {
}
// Put your extension initialization code here
-function main() {
+function main(metadata) {
+ imports.gettext.bindtextdomain('gnome-shell-extensions', metadata.localedir);
+
Main.panel.actor.reactive = true;
Main.panel.actor.connect('button-release-event', _showHello);
}
diff --git a/extensions/xrandr-indicator/extension.js b/extensions/xrandr-indicator/extension.js
index 6cc0bd2..da95767 100644
--- a/extensions/xrandr-indicator/extension.js
+++ b/extensions/xrandr-indicator/extension.js
@@ -13,7 +13,7 @@ const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
const Panel = imports.ui.panel;
-const Gettext = imports.gettext.domain('gnome-shell');
+const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
const possibleRotations = [ GnomeDesktop.RRRotation.ROTATION_0,
@@ -130,6 +130,8 @@ Indicator.prototype = {
}
-function main() {
+function main(metadata) {
+ imports.gettext.bindtextdomain('gnome-shell-extensions', metadata.localedir);
+
Panel.STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION['display'] = Indicator;
}
diff --git a/extensions/xrandr-indicator/metadata.json.in b/extensions/xrandr-indicator/metadata.json.in
index 35d117e..66d83ea 100644
--- a/extensions/xrandr-indicator/metadata.json.in
+++ b/extensions/xrandr-indicator/metadata.json.in
@@ -2,6 +2,6 @@
"uuid": "@uuid@",
"name": "Monitor Status Indicator",
"description": "Add a systems status menu for rotating monitors (overrides what is currently provided by gnome-settings-daemon)",
-"shell-version": [ "2.91.5", "@shell_current@" ],
+"shell-version": [ "@shell_current@" ],
"localedir": "@LOCALEDIR@"
}
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 0000000..7d5856f
--- /dev/null
+++ b/po/LINGUAS
@@ -0,0 +1 @@
+it
diff --git a/po/it.po b/po/it.po
new file mode 100644
index 0000000..a14cf73
--- /dev/null
+++ b/po/it.po
@@ -0,0 +1,42 @@
+# Italian translations for GNOME Shell extensions
+# Copyright (C) 2011 Giovanni Campagna et al.
+# This file is distributed under the same license as the gnome-shell-extensions package.
+# Giovanni Campagna <scampa giovanni gmail com>, 2011
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: gnome-shell-extensions 2.91.6\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-02-07 22:59+0100\n"
+"PO-Revision-Date: 2011-02-07 23:01+0100\n"
+"Last-Translator: Giovanni Campagna <scampa giovanni gmail com>\n"
+"Language-Team: none <LL li org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../extensions/example/extension.js:11
+msgid "Hello, world!"
+msgstr "Ciao, mondo!"
+
+#: ../extensions/xrandr-indicator/extension.js:25
+msgid "Normal"
+msgstr "Normale"
+
+#: ../extensions/xrandr-indicator/extension.js:26
+msgid "Left"
+msgstr "Sinistra"
+
+#: ../extensions/xrandr-indicator/extension.js:27
+msgid "Right"
+msgstr "Destra"
+
+#: ../extensions/xrandr-indicator/extension.js:28
+msgid "Upside-down"
+msgstr "Rovesciato"
+
+#: ../extensions/xrandr-indicator/extension.js:77
+msgid "Configure display settings..."
+msgstr "Configura impostazioni display..."
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]