Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for localization #29

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion indicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const World = Me.imports.world;
const Avatar = Me.imports.avatar;
const Convenience = Me.imports.convenience;

const Gettext = imports.gettext.domain('timezone@jwendell');
const _ = Gettext.gettext;

const TimezoneIndicator = new Lang.Class({
Name: 'TimezoneIndicator',
Extends: PanelMenu.Button,
Expand Down Expand Up @@ -154,7 +157,7 @@ const TimezoneIndicator = new Lang.Class({
});
}));

this._infoLabel.label = '%d people distributed in %d time zones...'.format(peopleCount, timezones.length);
this._infoLabel.label = _('%d people distributed in %d time zones...').format(peopleCount, timezones.length);
this._updateTimezones();
},

Expand Down
Binary file added locale/pt_BR/LC_MESSAGES/[email protected]
Binary file not shown.
7 changes: 5 additions & 2 deletions people.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const Me = ExtensionUtils.getCurrentExtension();
const Person = Me.imports.person;
const Convenience = Me.imports.convenience;

const Gettext = imports.gettext.domain('timezone@jwendell');
const _ = Gettext.gettext;

const People = new Lang.Class({
Name: 'People',

Expand Down Expand Up @@ -54,15 +57,15 @@ const People = new Lang.Class({
[success, contents, tag] = this._file.load_contents_finish(res);
} catch (e) {
log('Error parsing %s: %s'.format(this._path, e));
this._getPeopleOriginalCB({error: 'Make sure to put a file "people.json" in your home directory'});
this._getPeopleOriginalCB({error: _('Make sure to put a file "people.json" in your home directory')});
return;
}

try {
rawPeople = JSON.parse(contents);
} catch (e) {
log('Error parsing %s: %s'.format(this._path, e));
this._getPeopleOriginalCB({error: 'There was an error parsing people.json file'});
this._getPeopleOriginalCB({error: _('There was an error parsing people.json file')});
return;
}

Expand Down
66 changes: 66 additions & 0 deletions po/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Portuguese translations for PACKAGE package
# Traduções em português brasileiro para o pacote PACKAGE.
# Copyright (C) 2017 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Claudio André <[email protected]>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-23 22:07-0300\n"
"PO-Revision-Date: 2017-03-23 19:38-0300\n"
"Last-Translator: Claudio André <[email protected]>\n"
"Language-Team: Brazilian Portuguese\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#: indicator.js:28
msgid "Timezone Indicator"
msgstr "Indicador de Fuso Horário"

#: indicator.js:160
#, javascript-format
msgid "%d people distributed in %d time zones..."
msgstr "%d pessoas distribuídas em %d fusos horários..."

#: people.js:60
msgid "Make sure to put a file \"people.json\" in your home directory"
msgstr "Confirme se o arquivo \"people.json\" está em sua pasta pessoal"

#: people.js:68
msgid "There was an error parsing people.json file"
msgstr "Ocorreu um erro ao analisar o arquivo people.json"

#: prefs.js:24
msgid "<b>Location for the <i>people.json</i> file</b>"
msgstr "<b>Localização do arquivo <i>people.json</i></b>"

#: prefs.js:33
msgid ""
"<small>Remote files, e.g., starting with <i>http://</i> are also valid. <a "
"href=\"https://github.com/jwendell/gnome-shell-extension-timezone/blob/"
"master/editing-people.md\">Need help with JSON?</a></small>"
msgstr ""
"<small>Arquivos remotos, por exemplo, iniciados em <i>http://</i> são válidos. <a "
"href=\"https://github.com/jwendell/gnome-shell-extension-timezone/blob/"
"master/editing-people.md\">Precisa de ajuda com JSON?</a></small>"

#: prefs.js:54
msgid "<b>Highlight working hours</b>"
msgstr "<b>Destacar as horas de trabalho</b>"

#: prefs.js:67
msgid "From"
msgstr "Das"

#: prefs.js:72
msgid "to"
msgstr "às"

#: prefs.js:91
msgid "Save"
msgstr "Salvar"
15 changes: 9 additions & 6 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience;

const Gettext = imports.gettext.domain('timezone@jwendell');
const _ = Gettext.gettext;

const TimezoneExtensionPrefsWidget = new GObject.Class({
Name: 'TimezoneExtension.Prefs.Widget',
GTypeName: 'TimezoneExtensionPrefsWidget',
Expand All @@ -18,7 +21,7 @@ const TimezoneExtensionPrefsWidget = new GObject.Class({
this.margin = 12;
this._settings = Convenience.getSettings();

this.add(new Gtk.Label({ label: '<b>Location for the <i>people.json</i> file</b>',
this.add(new Gtk.Label({ label: _('<b>Location for the <i>people.json</i> file</b>'),
use_markup: true, margin_bottom: 6,
hexpand: true, halign: Gtk.Align.START }));

Expand All @@ -27,7 +30,7 @@ const TimezoneExtensionPrefsWidget = new GObject.Class({
box.add(this._createFileChooser());
this.add(box);

this.add(new Gtk.Label({ label: '<small>Remote files, e.g., starting with <i>http://</i> are also valid. <a href="https://github.com/jwendell/gnome-shell-extension-timezone/blob/master/editing-people.md">Need help with JSON?</a></small>',
this.add(new Gtk.Label({ label: _('<small>Remote files, e.g., starting with <i>http://</i> are also valid. <a href="https://github.com/jwendell/gnome-shell-extension-timezone/blob/master/editing-people.md">Need help with JSON?</a></small>'),
use_markup: true, margin_bottom: 6,
hexpand: true, halign: Gtk.Align.START}));

Expand All @@ -48,7 +51,7 @@ const TimezoneExtensionPrefsWidget = new GObject.Class({

let box1 = new Gtk.Box({orientation: Gtk.Orientation.HORIZONTAL, spacing: 5});
box.add(box1);
let label = new Gtk.Label({label: '<b>Highlight working hours</b>',
let label = new Gtk.Label({label: _('<b>Highlight working hours</b>'),
use_markup: true, hexpand: true,
halign: Gtk.Align.START});
box1.add(label);
Expand All @@ -61,12 +64,12 @@ const TimezoneExtensionPrefsWidget = new GObject.Class({
box.add(box2);
sb.bind_property('active', box2, 'sensitive', GObject.BindingFlags.SYNC_CREATE);

box2.add(new Gtk.Label({label: 'From'}));
box2.add(new Gtk.Label({label: _('From')}));
let from = Gtk.SpinButton.new_with_range (0, 23, 1);
box2.add(from);
this._settings.bind('working-hours-start', from, 'value', Gio.SettingsBindFlags.DEFAULT);

box2.add(new Gtk.Label({label: 'to'}));
box2.add(new Gtk.Label({label: _('to')}));
let to = Gtk.SpinButton.new_with_range (0, 23, 1);
box2.add(to);
this._settings.bind('working-hours-end', to, 'value', Gio.SettingsBindFlags.DEFAULT);
Expand All @@ -85,7 +88,7 @@ const TimezoneExtensionPrefsWidget = new GObject.Class({
},

_createSaveButton: function() {
let b = new Gtk.Button({label: "Save",
let b = new Gtk.Button({label: _("Save"),
halign: Gtk.Align.END,
hexpand: false,
can_default: true});
Expand Down