From 202bfb424caf301162733823c579a0589bceb263 Mon Sep 17 00:00:00 2001 From: coderkun Date: Sun, 17 Feb 2019 00:03:57 +0100 Subject: [PATCH] =?UTF-8?q?Use=20=E2=80=9Cgettext=E2=80=9D=20instead=20of?= =?UTF-8?q?=20=E2=80=9Clocale=E2=80=9D=20for=20L10N?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the documentation on the “locale” module states, the “gettext” module should be used instead. Therefore adjust the localization calls to use gettext instead. Additionally fix one button label which did not use localization at all and update the message catalogues. --- locale/de/LC_MESSAGES/mcg.mo | Bin 4247 -> 4247 bytes locale/de/LC_MESSAGES/mcg.po | 16 ++++++++-------- locale/en/LC_MESSAGES/mcg.mo | Bin 4004 -> 4004 bytes locale/en/LC_MESSAGES/mcg.po | 16 ++++++++-------- mcg/application.py | 5 +++-- mcg/widgets.py | 16 ++++++++-------- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/locale/de/LC_MESSAGES/mcg.mo b/locale/de/LC_MESSAGES/mcg.mo index 4a50ca4c69cf060fc5b83116887dfedb4f731b29..dbda698640f423c088237be0484a94a430aa7002 100644 GIT binary patch delta 56 zcmbQPI9+kWT}}Z@T>~RsLo)>ZV9rgRS8 delta 56 wcmbQPI9+kWT}}ZDT?0#9149KvODkhzZ3CmpZ#g9}1x2~`Ga7Eb%5{hp0H^W}>Hq)$ diff --git a/locale/de/LC_MESSAGES/mcg.po b/locale/de/LC_MESSAGES/mcg.po index 532447c..f5081ff 100644 --- a/locale/de/LC_MESSAGES/mcg.po +++ b/locale/de/LC_MESSAGES/mcg.po @@ -1,15 +1,15 @@ msgid "" msgstr "" "Project-Id-Version: CoverGrid (mcg)\n" -"POT-Creation-Date: 2018-09-01 19:33+0200\n" -"PO-Revision-Date: 2018-09-01 19:33+0200\n" +"POT-Creation-Date: 2019-02-16 23:50+0100\n" +"PO-Revision-Date: 2019-02-16 23:51+0100\n" "Last-Translator: coderkun \n" "Language-Team: \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.1.1\n" +"X-Generator: Poedit 2.2.1\n" "X-Poedit-Basepath: ../../..\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-SourceCharset: UTF-8\n" @@ -266,23 +266,23 @@ msgstr "Cover-Paneel" msgid "Library Panel" msgstr "Bibliothekspaneel" -#: mcg/utils.py:61 mcg/utils.py:71 +#: mcg/utils.py:62 mcg/utils.py:72 msgid "{} feat. {}" msgstr "{} mit {}" -#: mcg/widgets.py:1227 mcg/widgets.py:1549 +#: mcg/widgets.py:1267 mcg/widgets.py:1601 msgid "cancel" msgstr "abbrechen" -#: mcg/widgets.py:1244 mcg/widgets.py:1566 +#: mcg/widgets.py:1284 mcg/widgets.py:1618 msgid "play" msgstr "abspielen" -#: mcg/widgets.py:1247 +#: mcg/widgets.py:1287 msgid "remove" msgstr "entfernen" -#: mcg/widgets.py:1569 +#: mcg/widgets.py:1604 mcg/widgets.py:1621 msgid "queue" msgstr "einreihen" diff --git a/locale/en/LC_MESSAGES/mcg.mo b/locale/en/LC_MESSAGES/mcg.mo index 9a6a387b15338e4bc6756df3f1befec9aab3a71c..c4a9f18ee4713ee2d326632a50e5b2286dff41d1 100644 GIT binary patch delta 56 wcmZ1?zeIk+T}}Z@T>~RsLo)>\n" "Language-Team: \n" "Language: en\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.1.1\n" +"X-Generator: Poedit 2.2.1\n" "X-Poedit-Basepath: ../../..\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-SearchPath-0: data/gtk.glade\n" @@ -265,23 +265,23 @@ msgstr "Cover Panel" msgid "Library Panel" msgstr "Library Panel" -#: mcg/utils.py:61 mcg/utils.py:71 +#: mcg/utils.py:62 mcg/utils.py:72 msgid "{} feat. {}" msgstr "{} feat. {}" -#: mcg/widgets.py:1227 mcg/widgets.py:1549 +#: mcg/widgets.py:1267 mcg/widgets.py:1601 msgid "cancel" msgstr "cancel" -#: mcg/widgets.py:1244 mcg/widgets.py:1566 +#: mcg/widgets.py:1284 mcg/widgets.py:1618 msgid "play" msgstr "play" -#: mcg/widgets.py:1247 +#: mcg/widgets.py:1287 msgid "remove" msgstr "remove" -#: mcg/widgets.py:1569 +#: mcg/widgets.py:1604 mcg/widgets.py:1621 msgid "queue" msgstr "queue" diff --git a/mcg/application.py b/mcg/application.py index 7c06b25..0c47831 100644 --- a/mcg/application.py +++ b/mcg/application.py @@ -3,7 +3,7 @@ import gi gi.require_version('Gtk', '3.0') -import locale +import gettext import logging import urllib @@ -123,7 +123,8 @@ class Application(Gtk.Application): def _setup_locale(self): relpath = Environment.get_locale() - locale.bindtextdomain(Application.DOMAIN, relpath) + gettext.bindtextdomain(Application.DOMAIN, relpath) + gettext.textdomain(Application.DOMAIN) def _load_ui(self): diff --git a/mcg/widgets.py b/mcg/widgets.py index cd611c4..03278c6 100644 --- a/mcg/widgets.py +++ b/mcg/widgets.py @@ -8,7 +8,7 @@ try: use_keyring = True except: use_keyring = False -import locale +import gettext import logging import math import sys @@ -1264,7 +1264,7 @@ class PlaylistPanel(GObject.GObject): self._playlist_grid.set_tooltip_column(1) # Action bar (normal) actionbar = builder.get_object('playlist-actionbar') - cancel_button = Gtk.Button(locale.gettext("cancel")) + cancel_button = Gtk.Button(gettext.gettext("cancel")) cancel_button.connect('clicked', self.on_selection_cancel_clicked) actionbar.pack_start(cancel_button) remove_button = Gtk.Button('remove') @@ -1281,10 +1281,10 @@ class PlaylistPanel(GObject.GObject): self._standalone_image = builder.get_object('playlist-standalone-image') # Action bar (standalone) actionbar_standalone = builder.get_object('playlist-standalone-actionbar') - play_button = Gtk.Button(locale.gettext("play")) + play_button = Gtk.Button(gettext.gettext("play")) play_button.connect('clicked', self.on_standalone_play_clicked) actionbar_standalone.pack_end(play_button) - remove_button = Gtk.Button(locale.gettext("remove")) + remove_button = Gtk.Button(gettext.gettext("remove")) remove_button.connect('clicked', self.on_standalone_remove_clicked) actionbar_standalone.pack_end(remove_button) @@ -1598,10 +1598,10 @@ class LibraryPanel(GObject.GObject): self._library_grid.set_tooltip_column(1) # Action bar (normal) actionbar = builder.get_object('library-actionbar') - cancel_button = Gtk.Button(locale.gettext("cancel")) + cancel_button = Gtk.Button(gettext.gettext("cancel")) cancel_button.connect('clicked', self.on_selection_cancel_clicked) actionbar.pack_start(cancel_button) - add_button = Gtk.Button("queue") + add_button = Gtk.Button(gettext.gettext("queue")) add_button.connect('clicked', self.on_selection_add_clicked) actionbar.pack_end(add_button) @@ -1615,10 +1615,10 @@ class LibraryPanel(GObject.GObject): self._standalone_image = builder.get_object('library-standalone-image') # Action bar (standalone) actionbar_standalone = builder.get_object('library-standalone-actionbar') - play_button = Gtk.Button(locale.gettext("play")) + play_button = Gtk.Button(gettext.gettext("play")) play_button.connect('clicked', self.on_standalone_play_clicked) actionbar_standalone.pack_end(play_button) - queue_button = Gtk.Button(locale.gettext("queue")) + queue_button = Gtk.Button(gettext.gettext("queue")) queue_button.connect('clicked', self.on_standalone_queue_clicked) actionbar_standalone.pack_end(queue_button)