[polari] Mark strings in code as translatable
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] Mark strings in code as translatable
- Date: Thu, 8 Aug 2013 13:05:40 +0000 (UTC)
commit 52fba0bf8efe89a68775befc86a220ca0e7409be
Author: Florian Müllner <florian muellner gmail com>
Date: Sun Jul 21 14:41:35 2013 +0200
Mark strings in code as translatable
po/POTFILES.in | 2 ++
src/application.js | 34 +++++++++++++++++++++++++---------
src/chatView.js | 24 +++++++++++++-----------
src/connections.js | 4 ++--
src/userList.js | 2 +-
5 files changed, 43 insertions(+), 23 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1d7e731..43a30bc 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -5,5 +5,7 @@ data/polari.desktop.in
[type: gettext/glade]data/resources/join-room-dialog.ui
[type: gettext/glade]data/resources/main-window.ui
src/application.js
+src/chatView.js
+src/connections.js
src/mainWindow.js
src/userList.js
diff --git a/src/application.js b/src/application.js
index f48fc8e..74f8528 100644
--- a/src/application.js
+++ b/src/application.js
@@ -5,6 +5,7 @@ const Gtk = imports.gi.Gtk;
const Config = imports.config;
const Connections = imports.connections;
const Format = imports.format;
+const Gettext = imports.gettext;
const Lang = imports.lang;
const MainWindow = imports.mainWindow;
const Utils = imports.utils;
@@ -15,6 +16,9 @@ const Application = new Lang.Class({
_init: function() {
this.parent({ application_id: 'org.gnome.Polari' });
+
+ Gettext.bindtextdomain('polari', Config.LOCALE_DIR);
+ Gettext.textdomain('polari');
GLib.set_prgname('polari');
GLib.set_application_name('Polari');
this._window = null;
@@ -24,6 +28,9 @@ const Application = new Lang.Class({
this.parent();
String.prototype.format = Format.format;
+ window._ = Gettext.gettext;
+ window.C_ = Gettext.pgettext;
+
let resource = Gio.Resource.load(Config.RESOURCE_DIR + '/polari.gresource');
resource._register();
@@ -81,15 +88,24 @@ const Application = new Lang.Class({
},
_showAbout: function() {
- let authors = [ 'Florian M' + String.fromCharCode(0x00FC) + 'llner <fmuellner gnome org>' ];
- let dialog = new Gtk.AboutDialog({ transient_for: this._window.window,
- modal: true,
-
- authors: authors,
- comments: 'An Internet Relay Chat Client for GNOME',
- version: Config.PACKAGE_VERSION,
- license_type: Gtk.License.GPL_3_0,
- wrap_license: true });
+ let aboutParams = {
+ authors: [
+ 'Florian M' + String.fromCharCode(0x00FC) // ü
+ + 'llner <fmuellner gnome org>',
+ ],
+ translator_credits: _("translator-credits"),
+ comments: _('An Internet Relay Chat Client for GNOME'),
+ copyright: 'Copyright ' + String.fromCharCode(0x00A9) // ©
+ + ' 2013 Red Hat, Inc.',
+ license_type: Gtk.License.GPL_2_0,
+ wrap_license: true,
+ version: Config.PACKAGE_VERSION,
+
+ transient_for: this._window.window,
+ modal: true
+ };
+
+ let dialog = new Gtk.AboutDialog(aboutParams);
dialog.show();
dialog.connect('response', function() {
dialog.destroy();
diff --git a/src/chatView.js b/src/chatView.js
index c93e456..fef67bf 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -170,34 +170,36 @@ const ChatView = new Lang.Class({
},
_onMemberRenamed: function(room, oldMember, newMember) {
- this._insertStatus('%s is now known as %s'.format(oldMember.alias,
- newMember.alias));
+ this._insertStatus(_("%s is now known as %s").format(oldMember.alias,
+ newMember.alias));
},
_onMemberDisconnected: function(room, member) {
- this._insertStatus('%s has disconnected'.format(member.alias));
+ this._insertStatus(_("%s has disconnected").format(member.alias));
},
_onMemberKicked: function(room, member, actor) {
- let message = !actor ? '%s has been kicked'.format(member.alias)
- : '%s has been kicked by %s'.format(member.alias,
- actor.alias);
+ let message =
+ actor ? _("%s has been kicked by %s").format(member.alias,
+ actor.alias)
+ : _("%s has been kicked").format(member.alias);
this._insertStatus(message);
},
_onMemberBanned: function(room, member, actor) {
- let message = !actor ? '%s has been banned'.format(member.alias)
- : '%s has been banned by %s'.format(member.alias,
- actor.alias);
+ let message =
+ actor ? _("%s has been banned by %s").format(member.alias,
+ actor.alias)
+ : _("%s has been banned").format(member.alias)
this._insertStatus(message);
},
_onMemberJoined: function(room, member) {
- this._insertStatus('%s joined'.format(member.alias));
+ this._insertStatus(_("%s joined").format(member.alias));
},
_onMemberLeft: function(room, member, message) {
- let text = '%s left'.format(member.alias);
+ let text = _("%s left").format(member.alias);
if (message)
text += ' (%s)'.format(message);
this._insertStatus(text);
diff --git a/src/connections.js b/src/connections.js
index bbbb05d..722c5fa 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -205,8 +205,8 @@ const ConnectionDetailsDialog = new Lang.Class({
this._createWindow();
if (account) {
- this.widget.title = 'Edit Connection';
- this._confirmButton.label = 'Apply';
+ this.widget.title = _("Edit Connection");
+ this._confirmButton.label = _("A_pply");
this._populateFromAccount(account);
}
diff --git a/src/userList.js b/src/userList.js
index 8efe40f..e35dd69 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -101,7 +101,7 @@ const UserList = new Lang.Class({
margin_left: 6,
margin_right: 6,
spacing: 6 });
- box.add(new Gtk.Label({ label: '<b>' + "All" + '</b>',
+ box.add(new Gtk.Label({ label: '<b>' + _("All") + '</b>',
use_markup: true,
hexpand: true,
halign: Gtk.Align.START }));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]