add internationalization support
This commit is contained in:
parent
01401a60fc
commit
af0e529044
@ -18,28 +18,31 @@
|
||||
|
||||
import sys
|
||||
from argparse import ArgumentParser
|
||||
import gettext
|
||||
|
||||
from lubuntubreeze import breezeconfig
|
||||
|
||||
if __name__ == "__main__":
|
||||
localesApp ="lubuntu-breeze-config"
|
||||
localesDir ="/usr/share/locale"
|
||||
gettext.bindtextdomain(localesApp, localesDir)
|
||||
gettext.textdomain(localesApp)
|
||||
_ = gettext.gettext
|
||||
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('--version',
|
||||
action='version',
|
||||
version='%(prog)s 0.1')
|
||||
parser.add_argument("--data-dir",
|
||||
dest="datadir",
|
||||
default="/usr/share/lubuntu-breeze-config", # modificar al final
|
||||
help="data directory for UI files")
|
||||
default="/usr/share/lubuntu-breeze-config",
|
||||
help=_("data directory for UI files, default "
|
||||
"/usr/share/lubuntu-breeze-config"))
|
||||
parser.add_argument("--bin-dir",
|
||||
dest="bindir",
|
||||
default="/bin", # modificar al final
|
||||
help="directory where this script is, default /bin")
|
||||
default="/bin",
|
||||
help=_("directory where this script is, default /bin"))
|
||||
options = parser.parse_args()
|
||||
|
||||
# TODO translations replace gettext with _ ???
|
||||
# localesApp="lubuntu-breeze"
|
||||
# localesDir="/usr/share/locale"
|
||||
# gettext.bindtextdomain(localesApp, localesDir)
|
||||
# gettext.textdomain(localesApp)
|
||||
# to test run as "./breeze-config --data-dir data --bin-dir ."
|
||||
breezeconfig.main(sys.argv, options)
|
||||
|
3
debian/control
vendored
3
debian/control
vendored
@ -6,7 +6,8 @@ Build-Depends: debhelper-compat (= 12),
|
||||
dh-python,
|
||||
python3-all,
|
||||
python3-setuptools,
|
||||
xvfb
|
||||
xvfb,
|
||||
gettext
|
||||
Standards-Version: 4.5.0
|
||||
Rules-Requires-Root: no
|
||||
Testsuite: autopkgtest-pkg-python
|
||||
|
3
debian/lubuntu-breeze-config.install
vendored
3
debian/lubuntu-breeze-config.install
vendored
@ -1,2 +1 @@
|
||||
# data/breeze-color.desktop /usr/share/applications/breeze-color.desktop
|
||||
# data/designer /usr/share/lubuntu-breeze-color/designer
|
||||
# usr/share/locale/*
|
||||
|
@ -25,7 +25,6 @@ from PyQt5.QtWidgets import (QWidget, QApplication, QDialogButtonBox)
|
||||
from PyQt5.QtCore import (QDir, qDebug, QSettings)
|
||||
from PyQt5 import uic
|
||||
from gettext import gettext as _
|
||||
# better than in main "_ = gettext.gettext" for testing
|
||||
|
||||
|
||||
class MainWindow(QWidget):
|
||||
@ -52,13 +51,15 @@ class MainWindow(QWidget):
|
||||
self.label3b.setText(_("Opaque"))
|
||||
t = _("Applications need to be restarted for changes to take effect.")
|
||||
t += "<br/>"
|
||||
t += _("In case of pcmanfm-qt, since it handles the desktop, ")
|
||||
t += _("a restart of the desktop is needed") + "<br/>"
|
||||
t += _("In case of pcmanfm-qt, since it handles the desktop, "
|
||||
"a restart of the desktop is needed")
|
||||
t += "<br/>"
|
||||
t += _("Easier, restart session.")
|
||||
t += "<br/>"
|
||||
t += _("Best results if a matching GTK Theme is selected.")
|
||||
t += "<br/>"
|
||||
t += _("A compositor (Compton) needs to be enabled for transparency.")
|
||||
t += _("Compton (or other compositor) needs to be enabled "
|
||||
"for transparency.")
|
||||
|
||||
self.note.setText('<font size="-1">' + t + '</font>')
|
||||
sDir = QDir(self.schemeDir)
|
||||
@ -152,5 +153,4 @@ class App(QApplication):
|
||||
def main(args, options):
|
||||
global app
|
||||
app = App(options, args)
|
||||
# app.setWindowIcon(QIcon.fromTheme("preferences-desktop-color"))
|
||||
app.exec_()
|
||||
|
75
po/de.po
Normal file
75
po/de.po
Normal file
@ -0,0 +1,75 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-09-11 12:36-0300\n"
|
||||
"PO-Revision-Date: 2020-09-11 13:04-0300\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 2.3\n"
|
||||
"Last-Translator: \n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Language: de\n"
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:48
|
||||
msgid "Select Color Scheme for Breeze Qt Style:"
|
||||
msgstr "Wählen Sie das Farbschema für Breeze Qt Style:"
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:49
|
||||
msgid "Menu Transparency"
|
||||
msgstr "Menü Transparenz"
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:50
|
||||
msgid "Transparent"
|
||||
msgstr "Transparent"
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:51
|
||||
msgid "Opaque"
|
||||
msgstr "Undurchsichtig"
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:52
|
||||
msgid "Applications need to be restarted for changes to take effect."
|
||||
msgstr ""
|
||||
"Anwendungen müssen neu gestartet werden, damit Änderungen wirksam werden."
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:54
|
||||
msgid ""
|
||||
"In case of pcmanfm-qt, since it handles the desktop, a restart of the "
|
||||
"desktop is needed"
|
||||
msgstr ""
|
||||
"Im Fall von pcmanfm-qt ist ein Neustart des Desktops erforderlich, da "
|
||||
"dieser den Desktop verwaltet"
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:57
|
||||
msgid "Easier, restart session."
|
||||
msgstr "Einfachere, Sitzung neu starten."
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:59
|
||||
msgid "Best results if a matching GTK Theme is selected."
|
||||
msgstr "Beste Ergebnisse, wenn ein passendes GTK-Thema ausgewählt ist."
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:61
|
||||
msgid "Compton (or other compositor) needs to be enabled for transparency."
|
||||
msgstr ""
|
||||
"Compton (oder ein anderer Compositor) muss für Transparenz aktiviert sein."
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:68
|
||||
msgid "None"
|
||||
msgstr "Keiner"
|
||||
|
||||
#: breeze-config:39
|
||||
msgid "data directory for UI files, default /usr/share/lubuntu-breeze-config"
|
||||
msgstr ""
|
||||
"Datenverzeichnis für UI-Dateien, Standard / usr / share / lubuntu-windze-"
|
||||
"config"
|
||||
|
||||
#: breeze-config:44
|
||||
msgid "directory where this script is, default /bin"
|
||||
msgstr "Verzeichnis, in dem sich dieses Skript befindet, Standard / bin"
|
73
po/es.po
73
po/es.po
@ -1,37 +1,74 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR ORGANIZATION
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2020-03-02 20:52-0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-09-11 12:36-0300\n"
|
||||
"PO-Revision-Date: 2020-09-11 12:44-0300\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
"X-Generator: Poedit 2.3\n"
|
||||
"Last-Translator: \n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Language: es\n"
|
||||
|
||||
|
||||
#: lubuntuBreeze.py:39
|
||||
#: lubuntubreeze/breezeconfig.py:48
|
||||
msgid "Select Color Scheme for Breeze Qt Style:"
|
||||
msgstr "Selecciona el Esquema de Color de Breeze para el estilo Qt"
|
||||
msgstr "Selecciona el Esquema de Color de Breeze para el estilo Qt:"
|
||||
|
||||
#: lubuntuBreeze.py:40
|
||||
#: lubuntubreeze/breezeconfig.py:49
|
||||
msgid "Menu Transparency"
|
||||
msgstr "Transparencia de Menú"
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:50
|
||||
msgid "Transparent"
|
||||
msgstr "Transparente"
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:51
|
||||
msgid "Opaque"
|
||||
msgstr "Opaco"
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:52
|
||||
msgid "Applications need to be restarted for changes to take effect."
|
||||
msgstr "Las aplicaciones se deben reiniciar para que los cambios tengan efecto."
|
||||
msgstr ""
|
||||
"Las aplicaciones se deben reiniciar para que los cambios tengan efecto."
|
||||
|
||||
#: lubuntuBreeze.py:42
|
||||
msgid "In case of pcmanfm-qt, since it handles the desktop, a restart of the desktop is needed"
|
||||
msgstr "En caso de pcmanfm-qt, dado que maneja el escritorio, un reinicio del escritorio es necesario"
|
||||
#: lubuntubreeze/breezeconfig.py:54
|
||||
msgid ""
|
||||
"In case of pcmanfm-qt, since it handles the desktop, a restart of the "
|
||||
"desktop is needed"
|
||||
msgstr ""
|
||||
"En caso de pcmanfm-qt, dado que maneja el escritorio, un reinicio del "
|
||||
"escritorio es necesario"
|
||||
|
||||
#: lubuntuBreeze.py:44
|
||||
#: lubuntubreeze/breezeconfig.py:57
|
||||
msgid "Easier, restart session."
|
||||
msgstr "Más fácil es reiniciar la sesión"
|
||||
msgstr "Más fácil es reiniciar la sesión."
|
||||
|
||||
#: lubuntuBreeze.py:46
|
||||
#: lubuntubreeze/breezeconfig.py:59
|
||||
msgid "Best results if a matching GTK Theme is selected."
|
||||
msgstr "Mejores resultados si se ocupa un tema GTK que se asemeje."
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:61
|
||||
msgid "Compton (or other compositor) needs to be enabled for transparency."
|
||||
msgstr "Compton (u otro compositor) debe estar activo para transparencias."
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:68
|
||||
msgid "None"
|
||||
msgstr "Ninguno"
|
||||
|
||||
#: breeze-config:39
|
||||
msgid "data directory for UI files, default /usr/share/lubuntu-breeze-config"
|
||||
msgstr ""
|
||||
"directorio de datos para archivos UI, por defecto /usr/share/lubuntu-"
|
||||
"breeze-config"
|
||||
|
||||
#: breeze-config:44
|
||||
msgid "directory where this script is, default /bin"
|
||||
msgstr "directorio donde está este script, por defecto /bin"
|
||||
|
@ -1,37 +0,0 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR ORGANIZATION
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2020-03-02 20:52-0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
|
||||
#: lubuntuBreeze.py:39
|
||||
msgid "Select Color Scheme for Breeze Qt Style:"
|
||||
msgstr ""
|
||||
|
||||
#: lubuntuBreeze.py:40
|
||||
msgid "Applications need to be restarted for changes to take effect."
|
||||
msgstr ""
|
||||
|
||||
#: lubuntuBreeze.py:42
|
||||
msgid "In case of pcmanfm-qt, since it handles the desktop, a restart of the desktop is needed"
|
||||
msgstr ""
|
||||
|
||||
#: lubuntuBreeze.py:44
|
||||
msgid "Easier, restart session."
|
||||
msgstr ""
|
||||
|
||||
#: lubuntuBreeze.py:46
|
||||
msgid "Best results if a matching GTK Theme is selected."
|
||||
msgstr ""
|
||||
|
68
po/lubuntu-breeze-config.pot
Normal file
68
po/lubuntu-breeze-config.pot
Normal file
@ -0,0 +1,68 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-09-11 12:36-0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:48
|
||||
msgid "Select Color Scheme for Breeze Qt Style:"
|
||||
msgstr ""
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:49
|
||||
msgid "Menu Transparency"
|
||||
msgstr ""
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:50
|
||||
msgid "Transparent"
|
||||
msgstr ""
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:51
|
||||
msgid "Opaque"
|
||||
msgstr ""
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:52
|
||||
msgid "Applications need to be restarted for changes to take effect."
|
||||
msgstr ""
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:54
|
||||
msgid ""
|
||||
"In case of pcmanfm-qt, since it handles the desktop, a restart of the "
|
||||
"desktop is needed"
|
||||
msgstr ""
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:57
|
||||
msgid "Easier, restart session."
|
||||
msgstr ""
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:59
|
||||
msgid "Best results if a matching GTK Theme is selected."
|
||||
msgstr ""
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:61
|
||||
msgid "Compton (or other compositor) needs to be enabled for transparency."
|
||||
msgstr ""
|
||||
|
||||
#: lubuntubreeze/breezeconfig.py:68
|
||||
msgid "None"
|
||||
msgstr ""
|
||||
|
||||
#: breeze-config:39
|
||||
msgid "data directory for UI files, default /usr/share/lubuntu-breeze-config"
|
||||
msgstr ""
|
||||
|
||||
#: breeze-config:44
|
||||
msgid "directory where this script is, default /bin"
|
||||
msgstr ""
|
@ -1,2 +1,5 @@
|
||||
[build_i18n]
|
||||
domain=lubuntu-breeze-config
|
||||
|
||||
[sdist]
|
||||
formats = bztar
|
||||
|
42
setup.py
42
setup.py
@ -17,14 +17,50 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from setuptools import setup
|
||||
import subprocess
|
||||
import os
|
||||
from distutils.command.clean import clean
|
||||
|
||||
|
||||
class MyClean(clean):
|
||||
def run(self):
|
||||
# Execute the classic clean command
|
||||
super().run()
|
||||
|
||||
# Custom clean
|
||||
print("Removing translations")
|
||||
subprocess.run(['rm', '-rf', 'translations'])
|
||||
|
||||
|
||||
def add_mo_files(data_files):
|
||||
app_name = 'lubuntu-breeze-config'
|
||||
mo = ''
|
||||
|
||||
subprocess.run(['mkdir', 'translations/'])
|
||||
for f in os.listdir('po'):
|
||||
loc, ext = os.path.splitext(f)
|
||||
if ext == '.po':
|
||||
mo = app_name + '.mo'
|
||||
subprocess.run(['mkdir', 'translations/' + loc])
|
||||
subprocess.run(['msgfmt', '-o', 'translations/' + loc + '/' + mo,
|
||||
'po/' + f], check=True)
|
||||
|
||||
data_files.append(('share/locale/' + loc + '/LC_MESSAGES/',
|
||||
['translations/' + loc + '/' + mo]))
|
||||
|
||||
return data_files
|
||||
|
||||
|
||||
data_files = [('share/applications/', ['data/breeze-config.desktop']),
|
||||
('share/lubuntu-breeze-config/designer/',
|
||||
['data/designer/main.ui'])]
|
||||
|
||||
setup(
|
||||
name="lubuntu-breeze-config",
|
||||
version="0.1.dev0",
|
||||
packages=['lubuntubreeze'],
|
||||
scripts=['breeze-config'],
|
||||
data_files=[('share/applications/', ['data/breeze-config.desktop']),
|
||||
('share/lubuntu-breeze-config/designer/',
|
||||
['data/designer/main.ui'])],
|
||||
data_files=add_mo_files(data_files),
|
||||
test_suite="tests",
|
||||
cmdclass={'clean': MyClean}
|
||||
)
|
||||
|
2
translation_helper
Normal file
2
translation_helper
Normal file
@ -0,0 +1,2 @@
|
||||
xgettext lubuntubreeze/breezeconfig.py breeze-config --language=Python
|
||||
mv messages.po po/lubuntu-breeze-config.pot
|
Loading…
x
Reference in New Issue
Block a user