diff --git a/breeze-config b/breeze-config index a5402d4..f8818bb 100755 --- a/breeze-config +++ b/breeze-config @@ -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) diff --git a/debian/control b/debian/control index 2c4e792..6505fd6 100644 --- a/debian/control +++ b/debian/control @@ -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 diff --git a/debian/lubuntu-breeze-config.install b/debian/lubuntu-breeze-config.install index 7b27f80..61b0a15 100644 --- a/debian/lubuntu-breeze-config.install +++ b/debian/lubuntu-breeze-config.install @@ -1,2 +1 @@ -# data/breeze-color.desktop /usr/share/applications/breeze-color.desktop -# data/designer /usr/share/lubuntu-breeze-color/designer +# usr/share/locale/* diff --git a/lubuntubreeze/breezeconfig.py b/lubuntubreeze/breezeconfig.py index 22283d6..717b4e3 100755 --- a/lubuntubreeze/breezeconfig.py +++ b/lubuntubreeze/breezeconfig.py @@ -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 += "
" - t += _("In case of pcmanfm-qt, since it handles the desktop, ") - t += _("a restart of the desktop is needed") + "
" + t += _("In case of pcmanfm-qt, since it handles the desktop, " + "a restart of the desktop is needed") + t += "
" t += _("Easier, restart session.") t += "
" t += _("Best results if a matching GTK Theme is selected.") t += "
" - t += _("A compositor (Compton) needs to be enabled for transparency.") + t += _("Compton (or other compositor) needs to be enabled " + "for transparency.") self.note.setText('' + t + '') 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_() diff --git a/po/de.po b/po/de.po new file mode 100644 index 0000000..ff8953a --- /dev/null +++ b/po/de.po @@ -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 , 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" diff --git a/po/es.po b/po/es.po index 42ccdf2..74a93fd 100644 --- a/po/es.po +++ b/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 , 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 \n" -"Language-Team: LANGUAGE \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/breezeconfig.py:49 +msgid "Menu Transparency" +msgstr "Transparencia de Menú" + +#: lubuntubreeze/breezeconfig.py:50 +msgid "Transparent" +msgstr "Transparente" -#: lubuntuBreeze.py:40 +#: 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" diff --git a/po/lubuntu-breeze-color.pot b/po/lubuntu-breeze-color.pot deleted file mode 100644 index faf17c5..0000000 --- a/po/lubuntu-breeze-color.pot +++ /dev/null @@ -1,37 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR ORGANIZATION -# FIRST AUTHOR , 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 \n" -"Language-Team: LANGUAGE \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 "" - diff --git a/po/lubuntu-breeze-config.pot b/po/lubuntu-breeze-config.pot new file mode 100644 index 0000000..690045e --- /dev/null +++ b/po/lubuntu-breeze-config.pot @@ -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 , 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 \n" +"Language-Team: LANGUAGE \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 "" diff --git a/setup.cfg b/setup.cfg index ee3c6e9..4b9e529 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,5 @@ +[build_i18n] +domain=lubuntu-breeze-config + [sdist] formats = bztar diff --git a/setup.py b/setup.py index 3d90596..4677147 100644 --- a/setup.py +++ b/setup.py @@ -17,14 +17,50 @@ # along with this program. If not, see . 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} ) diff --git a/translation_helper b/translation_helper new file mode 100644 index 0000000..91cb9b9 --- /dev/null +++ b/translation_helper @@ -0,0 +1,2 @@ +xgettext lubuntubreeze/breezeconfig.py breeze-config --language=Python +mv messages.po po/lubuntu-breeze-config.pot