Update translations using python-distro and placeholders

This commit is contained in:
Silvan Calarco 2022-06-19 13:03:22 +02:00
parent 797e081b43
commit 6163f9ea7d
6 changed files with 193 additions and 213 deletions

View File

@ -54,7 +54,7 @@ install-dirs:
@$(INSTALL_DIR) $(DESTDIR)$(xdgautostartdir)
install: install-dirs install-locales
$(INSTALL_PROGRAM) src/mambatray $(DESTDIR)$(bindir)/mambatray
$(INSTALL_PROGRAM) mambatray.py $(DESTDIR)$(bindir)/mambatray
$(INSTALL_DATA) mambatray.desktop $(DESTDIR)$(xdgautostartdir)/mambatray.desktop
clean:
@ -62,7 +62,6 @@ clean:
rm -f $(dist_archive)
dist: clean
@git clean -f
@mkdir /tmp/$(distdir)
@cp -a * /tmp/$(distdir)/
@rm -f $(dist_archive);\

View File

@ -8,6 +8,7 @@ import sys
import os
import gettext
import libproxy
import distro
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtGui import QIcon, QCursor
from PyQt5.QtWidgets import QSystemTrayIcon, QApplication, QMenu, QMainWindow,\
@ -70,7 +71,7 @@ class SystemTrayIcon(QSystemTrayIcon):
softwareCheckUpgradesAction = softwareMenu.addAction(QIcon.fromTheme("system-software-update"),_("Check for updates now..."))
softwareCheckUpgradesAction.triggered.connect(self.softwareCheckUpgrades)
softwareBaseInstallsAction = softwareMenu.addAction(QIcon.fromTheme("openmamba"),_("openmamba components..."))
softwareBaseInstallsAction = softwareMenu.addAction(QIcon.fromTheme("system-logo"),_("{} components...").format(distro.name()))
softwareBaseInstallsAction.triggered.connect(self.softwareBaseInstalls)
# network menu
@ -101,7 +102,7 @@ class SystemTrayIcon(QSystemTrayIcon):
aboutAction = self.menu.addAction(QIcon.fromTheme("help-about"),_("About"))
aboutAction.triggered.connect(self.about)
self.setToolTip(_("openmamba control center"))
self.setToolTip(_("{} control center").format(distro.name()))
self.activated.connect(self.iconActivated)
self.setContextMenu(self.menu)
self.show()
@ -130,31 +131,9 @@ class SystemTrayIcon(QSystemTrayIcon):
self.contextMenu().popup(QCursor.pos())
def about(self):
global version
path = '/etc/openmamba-release'
if os.path.exists(path):
v = open(path, 'r')
version = v.read()
a = self.FormattaInfo()
version = "<ul><li>"+_("<font color=\"green\">open</font>mamba release:")+" <i>"+a[0]+"</i><li>"+_("Platform: ")+"<i>"+a[1]+"</i></ul>"
v.close()
else:
version = _("Error: Unable to find /etc/openmamba-release")
QMessageBox.about(self.menu, _("About"),
"<center><b>"+_("openmamba control center")+"</b>"
"<br><br>Copyright(c) 2011-2022 by Silvan Calarco"
"<br>Copyright(c) 2011 by michiamophil"
"<br><br><b>"+_("System info:")+"</b></center>"
""+_(version)+"<center><a href=\"https://openmamba.org\">https://openmamba.org</a></center>")
def FormattaInfo(self):
result = []
v = version
#result[0]=versione
result.append(v[ v.find("openmamba release ")+18 : v.find(" for") ] + " " + v[ v.find("(") : v.find(")")+1 ])
#result[1] = piattaforma
result.append(v[ v.find("for")+4 : v.find("(") ])
return result
"<center><b>"+_("{} control center").format(distro.name()+"</b>"
"<br/></br/>"+distro.name(pretty=True)+"</center>"))
def networkOnline(self):
return networkOnlineProcess.execute("/usr/bin/nm-online",['-q','-x'])
@ -240,7 +219,8 @@ class SystemTrayIcon(QSystemTrayIcon):
global NetsrpmsArg, lista
if not lista == []:
Lista = self.Lista()
msg = QMessageBox.question(self.menu, (_("Not Open Source openmamba components")), (_("The following components are available for update: ") + "\n\n" + Lista + "\n\n" + _("Ok to proceed?")), QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
msg = QMessageBox.question(self.menu,(_("Not Open Source {} components").format(distro.name())),
(_("The following components are available for update: ") + "\n\n" + Lista + "\n\n" + _("Ok to proceed?")), QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
if msg == QMessageBox.Yes:
NetsrpmsArg = '-u'
self.SRPMSCheckUpgradeList()
@ -265,8 +245,7 @@ def main():
else:
app.setQuitOnLastWindowClosed(0)
gettext.install('mambatray', '/usr/share/locale')
trayIcon = SystemTrayIcon(
QIcon.fromTheme("mambatray",QIcon("/usr/share/icons/hicolor/32x32/apps/mambatray.png"))
trayIcon = SystemTrayIcon(QIcon.fromTheme("mambatray")
)
sys.exit(app.exec_())

112
po/es.po
View File

@ -5,77 +5,89 @@
msgid ""
msgstr ""
"Project-Id-Version: 1.90\n"
"POT-Creation-Date: 2011-04-26 18:37+CEST\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-06-19 12:53+0200\n"
"PO-Revision-Date: 2011-04-26 18:37+CEST\n"
"Last-Translator: Silvan Calarco <silvan.calarco@mambasot.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"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"
#: mambatray.py:102 mambatray.py:134
msgid "About"
msgstr "Sobre"
#: src/mambatray:27
msgid "Software"
msgstr ""
#: src/mambatray:28
#: mambatray.py:68
msgid "Add/Remove software packages..."
msgstr "Añadir/Eliminar paquetes software..."
#: src/mambatray:31
#: mambatray.py:71
msgid "Check for updates now..."
msgstr "Controla la disponibilidad de actualizaciones..."
#: src/mambatray:34
msgid "openmamba components..."
msgstr "Componentes de openmamba..."
#: src/mambatray:44
msgid "Network"
msgstr "Red"
#: src/mambatray:45
msgid "Firewall"
msgstr ""
#: src/mambatray:46
msgid "Disable"
msgstr "Desactiva"
#: src/mambatray:49
msgid "Enable"
msgstr "Activa"
#: src/mambatray:52
#: mambatray.py:94
msgid "Configure..."
msgstr "Configura..."
#: src/mambatray:54
msgid "Proxy..."
msgstr ""
#: src/mambatray:59
msgid "About"
msgstr ""
#: src/mambatray:63
msgid "openmamba control center"
msgstr "Centro de control de openmamba"
#: src/mambatray:91
msgid "Firewall disabled in current session"
msgstr "Firewall desactivado en la sesión actual"
#: src/mambatray:93
#: mambatray.py:168
msgid "Could not disable firewall"
msgstr "No se ha podido desactivar el firewall"
#: src/mambatray:100
msgid "Firewall enabled in current session"
msgstr "Firewall activo en la sesión actual"
#: src/mambatray:102
#: mambatray.py:177
msgid "Could not enable firewall"
msgstr "No se ha podido activar el firewall"
#: mambatray.py:88
msgid "Disable"
msgstr "Desactiva"
#: mambatray.py:91
msgid "Enable"
msgstr "Activa"
#: mambatray.py:87
msgid "Firewall"
msgstr "Firewall"
#: mambatray.py:166
msgid "Firewall disabled in current session"
msgstr "Firewall desactivado en la sesión actual"
#: mambatray.py:175
msgid "Firewall enabled in current session"
msgstr "Firewall activo en la sesión actual"
#: mambatray.py:86
msgid "Network"
msgstr "Red"
#: mambatray.py:222
msgid "Not Open Source {} components"
msgstr "No componentes de código abierto de {}"
#: mambatray.py:223
msgid "Ok to proceed?"
msgstr "Bien para proceder?"
#: mambatray.py:96
msgid "Proxy..."
msgstr "Proxy..."
#: mambatray.py:67
msgid "Software"
msgstr "Software"
#: mambatray.py:223
msgid "The following components are available for update: "
msgstr "Los siguientes componentes están disponibles para actualizar"
#: mambatray.py:74
msgid "{} components..."
msgstr "Componentes de {}..."
#: mambatray.py:105 mambatray.py:135
msgid "{} control center"
msgstr "Centro de control de {}"

124
po/fr.po
View File

@ -5,97 +5,89 @@
msgid ""
msgstr ""
"Project-Id-Version: 1.90\n"
"POT-Creation-Date: 2011-04-26 18:37+CEST\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-06-19 12:53+0200\n"
"PO-Revision-Date: 2011-04-26 18:37+CEST\n"
"Last-Translator: Silvan Calarco <silvan.calarco@mambasot.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"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"
#: src/mambatray:27
msgid "Software"
msgstr "Logiciels"
#: src/mambatray:28
msgid "Add/Remove software packages..."
msgstr "Installer/Supprimer paquets logiciels..."
#: src/mambatray:31
msgid "Check for updates now..."
msgstr "Mise à jour du système..."
#: src/mambatray:34
msgid "openmamba components..."
msgstr "Composants de openmamba..."
#: src/mambatray:44
msgid "Network"
msgstr "Réseau"
#: src/mambatray:45
msgid "Firewall"
msgstr "Pare-feu"
#: src/mambatray:46
msgid "Disable"
msgstr "Désactiver"
#: src/mambatray:49
msgid "Enable"
msgstr "Activer"
#: src/mambatray:52
msgid "Configure..."
msgstr "Configurer..."
#: src/mambatray:54
msgid "Proxy..."
msgstr "Proxy..."
#: src/mambatray:59
#: mambatray.py:102 mambatray.py:134
msgid "About"
msgstr "Informations"
#: src/mambatray:63
msgid "openmamba control center"
msgstr "centre de contrôle d'openmamba"
#: mambatray.py:68
msgid "Add/Remove software packages..."
msgstr "Installer/Supprimer paquets logiciels..."
#: src/mambatray:91
msgid "Firewall disabled in current session"
msgstr "Pare-feu désactivé pour la session en cours"
#: mambatray.py:71
msgid "Check for updates now..."
msgstr "Mise à jour du système..."
#: src/mambatray:93
#: mambatray.py:94
msgid "Configure..."
msgstr "Configurer..."
#: mambatray.py:168
msgid "Could not disable firewall"
msgstr "Impossible de désactiver le pare-feu"
#: src/mambatray:100
msgid "Firewall enabled in current session"
msgstr "Pare-feu activé pour la session en cours"
#: src/mambatray:102
#: mambatray.py:177
msgid "Could not enable firewall"
msgstr "Impossible d'activer le pare-feu"
msgid "Not Open Source openmamba components"
msgstr "Composants non Open Source de openmamba"
#: mambatray.py:88
msgid "Disable"
msgstr "Désactiver"
msgid "The following components are available for update: "
msgstr "Les composants suivants sont disponibles pour la mise à jour: "
#: mambatray.py:91
msgid "Enable"
msgstr "Activer"
#: mambatray.py:87
msgid "Firewall"
msgstr "Pare-feu"
#: mambatray.py:166
msgid "Firewall disabled in current session"
msgstr "Pare-feu désactivé pour la session en cours"
#: mambatray.py:175
msgid "Firewall enabled in current session"
msgstr "Pare-feu activé pour la session en cours"
#: mambatray.py:86
msgid "Network"
msgstr "Réseau"
#: mambatray.py:222
msgid "Not Open Source {} components"
msgstr "Composants non open source de {}"
#: mambatray.py:223
msgid "Ok to proceed?"
msgstr "Mettre à jour maintenant?"
#: src/mambatray:107
msgid "Platform: "
msgstr "Plateforme: "
#: mambatray.py:96
msgid "Proxy..."
msgstr "Proxy..."
msgid "System info:"
msgstr "Informations système:"
#: mambatray.py:67
msgid "Software"
msgstr "Logiciels"
msgid "Error: Unable to find /etc/openmamba-release"
msgstr "Erreur: Impossible de trouver le fichier /etc/openmamba-release"
#: mambatray.py:223
msgid "The following components are available for update: "
msgstr "Les composants suivants sont disponibles pour la mise à jour: "
#: mambatray.py:74
msgid "{} components..."
msgstr "Composants de {}..."
#: mambatray.py:105 mambatray.py:135
msgid "{} control center"
msgstr "Centre de contrôle de {}"

124
po/it.po
View File

@ -5,97 +5,89 @@
msgid ""
msgstr ""
"Project-Id-Version: 1.90\n"
"POT-Creation-Date: 2011-04-26 18:37+CEST\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-06-19 12:53+0200\n"
"PO-Revision-Date: 2011-04-26 18:37+CEST\n"
"Last-Translator: Silvan Calarco <silvan.calarco@mambasot.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"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"
#: src/mambatray:27
msgid "Software"
msgstr ""
#: src/mambatray:28
msgid "Add/Remove software packages..."
msgstr "Aggiungi/Rimuovi applicazioni..."
#: src/mambatray:31
msgid "Check for updates now..."
msgstr "Verifica la presenza di aggiornamenti..."
#: src/mambatray:34
msgid "openmamba components..."
msgstr "Componenti di openmamba..."
#: src/mambatray:44
msgid "Network"
msgstr "Rete"
#: src/mambatray:45
msgid "Firewall"
msgstr ""
#: src/mambatray:46
msgid "Disable"
msgstr "Disabilita"
#: src/mambatray:49
msgid "Enable"
msgstr "Abilita"
#: src/mambatray:52
msgid "Configure..."
msgstr "Configura..."
#: src/mambatray:54
msgid "Proxy..."
msgstr ""
#: src/mambatray:59
#: mambatray.py:102 mambatray.py:134
msgid "About"
msgstr "Informazioni"
#: src/mambatray:63
msgid "openmamba control center"
msgstr "Centro di controllo di openmamba"
#: mambatray.py:68
msgid "Add/Remove software packages..."
msgstr "Aggiungi/Rimuovi applicazioni..."
#: src/mambatray:91
msgid "Firewall disabled in current session"
msgstr "Firewall disabilitato per la sessione corrente"
#: mambatray.py:71
msgid "Check for updates now..."
msgstr "Verifica la presenza di aggiornamenti..."
#: src/mambatray:93
#: mambatray.py:94
msgid "Configure..."
msgstr "Configura..."
#: mambatray.py:168
msgid "Could not disable firewall"
msgstr "Non è stato possibile disabilitare il firewall"
#: src/mambatray:100
msgid "Firewall enabled in current session"
msgstr "Firewall abilitato per la sessione corrente"
#: src/mambatray:102
#: mambatray.py:177
msgid "Could not enable firewall"
msgstr "Non è stato possibile abilitare il firewall"
msgid "Not Open Source openmamba components"
msgstr "Componenti non Open Source di openmamba"
#: mambatray.py:88
msgid "Disable"
msgstr "Disabilita"
msgid "The following components are available for update: "
msgstr "I seguenti componenti sono disponibili per l'aggiornamento: "
#: mambatray.py:91
msgid "Enable"
msgstr "Abilita"
#: mambatray.py:87
msgid "Firewall"
msgstr "Firewall"
#: mambatray.py:166
msgid "Firewall disabled in current session"
msgstr "Firewall disabilitato per la sessione corrente"
#: mambatray.py:175
msgid "Firewall enabled in current session"
msgstr "Firewall abilitato per la sessione corrente"
#: mambatray.py:86
msgid "Network"
msgstr "Rete"
#: mambatray.py:222
msgid "Not Open Source {} components"
msgstr "Componenti non Open Source di {}"
#: mambatray.py:223
msgid "Ok to proceed?"
msgstr "Aggiornare adesso?"
#: src/mambatray:107
msgid "Platform: "
msgstr "Piattaforma: "
#: mambatray.py:96
msgid "Proxy..."
msgstr "Proxy..."
msgid "System info:"
msgstr "Informazioni sul sistema:"
#: mambatray.py:67
msgid "Software"
msgstr "Software"
msgid "Error: Unable to find /etc/openmamba-release"
msgstr "Errore: Impossibile trovare il file /etc/openmamba-release"
#: mambatray.py:223
msgid "The following components are available for update: "
msgstr "I seguenti componenti sono disponibili per l'aggiornamento: "
#: mambatray.py:74
msgid "{} components..."
msgstr "Componenti di {}..."
#: mambatray.py:105 mambatray.py:135
msgid "{} control center"
msgstr "Centro di controllo di {}"

6
update-translations.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
xgettext -s -o - mambatray.py --output=po/messages.pot
for l in it es fr; do
msgmerge --update --no-fuzzy-matching --backup=off po/$l.po po/messages.pot
done
#lupdate-qt5 *.ui -ts mambatray_it.ts