Use “gettext” instead of “locale” for L10N

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.
This commit is contained in:
coderkun 2019-02-17 00:03:57 +01:00
parent c22ce2557c
commit 202bfb424c
6 changed files with 27 additions and 26 deletions

Binary file not shown.

View file

@ -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 <olli@suruatoel.xyz>\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"

Binary file not shown.

View file

@ -1,15 +1,15 @@
msgid ""
msgstr ""
"Project-Id-Version: CoverGrid (mcg)\n"
"POT-Creation-Date: 2018-09-01 19:34+0200\n"
"PO-Revision-Date: 2018-09-01 19:34+0200\n"
"POT-Creation-Date: 2019-02-16 23:52+0100\n"
"PO-Revision-Date: 2019-02-16 23:52+0100\n"
"Last-Translator: coderkun <olli@suruatoel.xyz>\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"

View file

@ -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):

View file

@ -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)