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.
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -8,6 +8,11 @@ config/
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
m4/
|
||||
po/gnome-shell-extensions.pot
|
||||
po/POTFILES
|
||||
po/stamp-it
|
||||
staging/
|
||||
|
||||
*~
|
||||
*.gmo
|
||||
metadata.json
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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@"
|
||||
}
|
||||
|
||||
1
po/LINGUAS
Normal file
1
po/LINGUAS
Normal file
@@ -0,0 +1 @@
|
||||
it
|
||||
42
po/it.po
Normal file
42
po/it.po
Normal file
@@ -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..."
|
||||
Reference in New Issue
Block a user