summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
authornecoro <>2007-08-05 04:11:46 +0000
committernecoro <>2007-08-05 04:11:46 +0000
commit8fe46a012d17eaa874abf63b9be93c6f11b8df97 (patch)
tree517e994fa610586e83d297997a4865f7b3b86af4 /portato
parent0087f656a2d9fe962d874ae73f5759dbfc09f634 (diff)
downloadportato-8fe46a012d17eaa874abf63b9be93c6f11b8df97.tar.gz
portato-8fe46a012d17eaa874abf63b9be93c6f11b8df97.tar.bz2
portato-8fe46a012d17eaa874abf63b9be93c6f11b8df97.zip
i18n support and german translations
Diffstat (limited to 'portato')
-rw-r--r--portato/backend/flags.py3
-rw-r--r--portato/backend/portage/package.py3
-rw-r--r--portato/backend/portage/system.py7
-rw-r--r--portato/config_parser.py3
-rw-r--r--portato/constants.py3
-rw-r--r--portato/gui/gtk/dialogs.py17
-rw-r--r--portato/gui/gtk/uncaughtException.py12
-rw-r--r--portato/gui/gtk/windows.py72
-rw-r--r--portato/gui/gtk/wrapper.py7
-rw-r--r--portato/gui/gui_helper.py2
-rw-r--r--portato/helper.py3
-rw-r--r--portato/plugin.py25
-rw-r--r--portato/plugins/etc_proposals.py7
-rw-r--r--portato/plugins/resume_loop.py3
14 files changed, 93 insertions, 74 deletions
diff --git a/portato/backend/flags.py b/portato/backend/flags.py
index 6c2a159..dd1e462 100644
--- a/portato/backend/flags.py
+++ b/portato/backend/flags.py
@@ -13,6 +13,7 @@
import os
import os.path
from subprocess import Popen, PIPE # needed for grep
+from gettext import lgettext as _
from portato.helper import *
from portato.backend import system
@@ -478,7 +479,7 @@ def new_masking_status (cpv):
for file, line in list[cpv]:
_ret = (int(line) == -1)
if ret is not None and _ret != ret:
- error("Conflicting values for masking status: %s", list)
+ error(_("Conflicting values for masking status: %s"), list)
else:
ret = _ret
return ret
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py
index a1bf433..7ab1713 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -18,6 +18,7 @@ import portage, portage_dep
from portage_util import unique_array
import os.path
+from gettext import lgettext as _
class PortagePackage (Package):
"""This is a class abstracting a normal package which can be installed for the portage-system."""
@@ -89,7 +90,7 @@ class PortagePackage (Package):
if status == "masked": return True
elif status == "unmasked": return False
else:
- error("BUG in flags.new_masking_status. It returns \'%s\'", status)
+ error(_("BUG in flags.new_masking_status. It returns \'%s\'"), status)
else: # we have not touched the status
if self._status and ("profile" in self._status or "package.mask" in self._status):
return True
diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py
index 44ac404..bf1b821 100644
--- a/portato/backend/portage/system.py
+++ b/portato/backend/portage/system.py
@@ -12,6 +12,7 @@
import re, os
import types
+from gettext import lgettext as _
import portage
import package
@@ -282,7 +283,7 @@ class PortageSystem (SystemInterface):
best_p = self.find_best_match(p)
if best_p is None:
- warning("No best match for %s. It seems not to be in the tree anymore." % p)
+ warning(_("No best match for %s. It seems not to be in the tree anymore.") % p)
continue
if len(inst) > 1:
@@ -339,7 +340,7 @@ class PortageSystem (SystemInterface):
oldList = self.sort_package_list(self.find_installed_packages(p.get_cp()))
if not oldList:
if add_not_installed:
- info("Found a not installed dependency: %s." % p.get_cpv())
+ info(_("Found a not installed dependency: %s.") % p.get_cpv())
oldList = [p]
else:
return
@@ -379,7 +380,7 @@ class PortageSystem (SystemInterface):
raw_checked.append(i)
bm = self.get_new_packages([i])
if not bm:
- warning("Bug? No best match could be found for '%s'. Needed by: '%s'.", i, p.get_cpv())
+ warning(_("Bug? No best match could be found for '%(package)s'. Needed by: '%(cpv)s'."), {"package" : i, "cpv": p.get_cpv()})
else:
for pkg in bm:
if not pkg: continue
diff --git a/portato/config_parser.py b/portato/config_parser.py
index 32e0518..8555fc0 100644
--- a/portato/config_parser.py
+++ b/portato/config_parser.py
@@ -31,6 +31,7 @@ Currently supported are the values (case insensitive): false, 0, off, falsch, ne
"""
from helper import debug
+from gettext import lgettext as _
import re
import types
@@ -207,7 +208,7 @@ class ConfigParser:
self.vars[section][key] = Value(val, count, bool = bool)
self.pos[count] = match.span(2)
else: # neither comment nor empty nor expression nor section => error
- error("Unrecognized line in configuration: %s", line)
+ error(_("Unrecognized line in configuration: %s"), line)
def get (self, key, section = "MAIN"):
"""Returns the value of a given key in a section.
diff --git a/portato/constants.py b/portato/constants.py
index c17ee24..80e7452 100644
--- a/portato/constants.py
+++ b/portato/constants.py
@@ -39,6 +39,7 @@ These should be set during the installation.
"""
from os.path import join as pjoin
+APP = "portato"
VERSION = "9999"
CONFIG_DIR = "/etc/portato/"
@@ -53,5 +54,7 @@ XSD_LOCATION = pjoin(XSD_DIR, "plugin.xsd")
ICON_DIR = "icons/"
APP_ICON = pjoin(ICON_DIR, "portato-icon.png")
+LOCALE_DIR = "i18n/"
+
FRONTENDS = ["gtk" ,"qt"]
STD_FRONTEND = "gtk"
diff --git a/portato/gui/gtk/dialogs.py b/portato/gui/gtk/dialogs.py
index 24d1a20..4750bb2 100644
--- a/portato/gui/gtk/dialogs.py
+++ b/portato/gui/gtk/dialogs.py
@@ -11,9 +11,10 @@
# Written by René 'Necoro' Neumann <necoro@necoro.net>
import gtk
+from gettext import lgettext as _
def queue_not_empty_dialog():
- dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, "There are some packages in the emerge queue and/or an emerge process is running.\nDo you really want to quit?")
+ dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, _("There are some packages in the emerge queue and/or an emerge process is running.\nDo you really want to quit?"))
ret = dialog.run()
dialog.destroy()
return ret
@@ -29,44 +30,44 @@ def io_ex_dialog (io_ex):
return ret
def blocked_dialog (blocked, blocks):
- dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, blocked+" is blocked by "+blocks+".\nPlease unmerge the blocking package.")
+ dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("%(blocked)s is blocked by %(blocks)s.\nPlease unmerge the blocking package.") % {"blocked":blocked, "blocks" : blocks})
ret = dialog.run()
dialog.destroy()
return ret
def not_root_dialog ():
- errorMB = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "You are not root.")
+ errorMB = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "_(You are not root."))
ret = errorMB.run()
errorMB.destroy()
return ret
def unmask_dialog (cpv):
- dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, cpv+" seems to be masked.\nDo you want to unmask it and its dependencies?")
+ dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, _("%s seems to be masked.\nDo you want to unmask it and its dependencies?") % cpv)
ret = dialog.run()
dialog.destroy()
return ret
def nothing_found_dialog ():
- dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, "Package not found!")
+ dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("Package not found!"))
ret = dialog.run()
dialog.destroy()
return ret
def changed_flags_dialog (what = "flags"):
hintMB = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
- "You have changed %s. Portato will write these changes into the appropriate files. Please backup them if you think it is necessairy." % what)
+ _("You have changed %s. Portato will write these changes into the appropriate files. Please backup them if you think it is necessairy.") % what)
ret = hintMB.run()
hintMB.destroy()
return ret
def remove_deps_dialog ():
- infoMB = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, "You cannot remove dependencies. :)")
+ infoMB = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("You cannot remove dependencies. :)"))
ret = infoMB.run()
infoMB.destroy()
return ret
def remove_queue_dialog ():
- askMB = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "Do you really want to clear the whole queue?")
+ askMB = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, _("Do you really want to clear the whole queue?"))
ret = askMB.run()
askMB.destroy()
return ret
diff --git a/portato/gui/gtk/uncaughtException.py b/portato/gui/gtk/uncaughtException.py
index d8ea13d..04f1a6e 100644
--- a/portato/gui/gtk/uncaughtException.py
+++ b/portato/gui/gtk/uncaughtException.py
@@ -17,17 +17,19 @@ import sys
import gtk, pango
from StringIO import StringIO
import traceback
+from gettext import lgettext as _
+
from portato.helper import error
class UncaughExceptionDialog(gtk.MessageDialog):
def __init__(self, type, value, tb):
- super(UncaughExceptionDialog,self).__init__(parent=None, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_NONE, message_format="A programming error has been detected during the execution of this program.")
- self.set_title("Bug Detected")
- self.format_secondary_text("It probably isn't fatal, but should be reported to the developers nonetheless.")
+ super(UncaughExceptionDialog,self).__init__(parent=None, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_NONE, message_format=_("A programming error has been detected during the execution of this program."))
+ self.set_title(_("Bug Detected"))
+ self.format_secondary_text(_("It probably isn't fatal, but should be reported to the developers nonetheless."))
- self.add_button("Show Details", 1)
+ self.add_button(_("Show Details"), 1)
self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
# Details
@@ -74,7 +76,7 @@ def get_trace(type, value, tb):
def register_ex_handler():
def handler(*args):
- error("An uncaught exception has occured: %s", get_trace(*args))
+ error(_("An uncaught exception has occured:\n%s"), get_trace(*args))
UncaughExceptionDialog(*args).run()
sys.excepthook = handler
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index 8cf9fb7..cc70122 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -12,14 +12,13 @@
# gtk stuff
import pygtk
-pygtk.require("2.0")
import gtk
import gtk.glade
import gobject
# our backend stuff
from portato.helper import *
-from portato.constants import CONFIG_LOCATION, VERSION, DATA_DIR, APP_ICON
+from portato.constants import CONFIG_LOCATION, VERSION, DATA_DIR, APP_ICON, APP, LOCALE_DIR
from portato.backend import flags, system
from portato.backend.exceptions import *
@@ -36,7 +35,10 @@ from usetips import UseTips
import types, logging
from subprocess import Popen
from threading import Thread
+from gettext import lgettext as _
+gtk.glade.bindtextdomain (APP, LOCALE_DIR)
+gtk.glade.textdomain (APP)
GLADE_FILE = DATA_DIR+"portato.glade"
class Window:
@@ -66,7 +68,7 @@ class Window:
return wrapper
def get_tree (self, name):
- return gtk.glade.XML(GLADE_FILE, root = name)
+ return gtk.glade.XML(GLADE_FILE, name)
class Popup:
@@ -141,15 +143,15 @@ class PluginWindow (AbstractDialog):
view.set_model(self.store)
cell = gtk.CellRendererText()
- col = gtk.TreeViewColumn("Plugin", cell, markup = 0)
+ col = gtk.TreeViewColumn(_("Plugin"), cell, markup = 0)
view.append_column(col)
- col = gtk.TreeViewColumn("Authors", cell, text = 1)
+ col = gtk.TreeViewColumn(_("Authors"), cell, text = 1)
view.append_column(col)
bcell = gtk.CellRendererToggle()
bcell.connect("toggled", self.cb_plugin_toggled)
- col = gtk.TreeViewColumn("Enabled", bcell, active = 2)
+ col = gtk.TreeViewColumn(_("Enabled"), bcell, active = 2)
view.append_column(col)
for p in [("<b>"+p.name+"</b>", p.author, p.is_enabled()) for p in plugins]:
@@ -195,8 +197,8 @@ class UpdateWindow (AbstractDialog):
tCell.set_property("activatable", True)
tCell.connect("toggled", self.cb_check_toggled) # emulate the normal toggle behavior ...
- self.view.append_column(gtk.TreeViewColumn("Enabled", tCell, active = 0))
- self.view.append_column(gtk.TreeViewColumn("Package", cell, text = 1))
+ self.view.append_column(gtk.TreeViewColumn(_("Enabled"), tCell, active = 0))
+ self.view.append_column(gtk.TreeViewColumn(_("Package"), cell, text = 1))
for p in self.packages:
store.append([False, p.get_cpv()])
@@ -294,7 +296,7 @@ class SearchWindow (AbstractDialog):
store.append(["%s/<b>%s</b>" % tuple(p.split("/"))])
cell = gtk.CellRendererText()
- col = gtk.TreeViewColumn("Results", cell, markup = 0)
+ col = gtk.TreeViewColumn(_("Results"), cell, markup = 0)
self.searchList.append_column(col)
def ok (self, *args):
@@ -563,7 +565,7 @@ class PackageTable:
def set_desc_label (self):
desc = self.actual_package().get_package_settings("DESCRIPTION").replace("&","&amp;")
if not desc:
- desc = "<no description>"
+ desc = _("<no description>")
use_markup = False
else:
desc = "<b>"+desc+"</b>"
@@ -592,7 +594,7 @@ class PackageTable:
exp = pkg.use_expanded(use, suggest = actual_exp)
if exp is not None:
if exp != actual_exp:
- actual_exp_it = store.append(None, [None, exp, "<i>This is an expanded use flag and cannot be selected</i>"])
+ actual_exp_it = store.append(None, [None, exp, "<i>%s</i>" % _("This is an expanded use flag and cannot be selected")])
actual_exp = exp
else:
actual_exp_it = None
@@ -610,9 +612,9 @@ class PackageTable:
tCell = gtk.CellRendererToggle()
tCell.set_property("activatable", True)
tCell.connect("toggled", self.cb_use_flag_toggled, store)
- self.useList.append_column(gtk.TreeViewColumn("Enabled", tCell, active = 0))
- self.useList.append_column(gtk.TreeViewColumn("Flags", cell, text = 1))
- self.useList.append_column(gtk.TreeViewColumn("Description", cell, markup = 2))
+ self.useList.append_column(gtk.TreeViewColumn(_("Enabled"), tCell, active = 0))
+ self.useList.append_column(gtk.TreeViewColumn(_("Flags"), cell, text = 1))
+ self.useList.append_column(gtk.TreeViewColumn(_("Description"), cell, markup = 2))
self.useList.set_search_column(1)
self.useList.set_enable_tree_lines(True)
@@ -627,7 +629,7 @@ class PackageTable:
# build view
self.versList.set_model(store)
- col = gtk.TreeViewColumn("Versions")
+ col = gtk.TreeViewColumn(("Versions"))
# adding the pixbuf
cell = gtk.CellRendererPixbuf()
@@ -691,7 +693,7 @@ class PackageTable:
try:
self.queue.append(self.actual_package().get_cpv(), unmerge = True)
except PackageNotFoundException, e:
- error("Package could not be found: %s", e[0])
+ error(_("Package could not be found: %s"), e[0])
#masked_dialog(e[0])
def cb_vers_list_changed (self, *args):
@@ -736,33 +738,33 @@ class PackageTable:
gtk.Tooltips().set_tip(self.maskedCheck, pkg.get_masking_reason()) # this returns None if it is not masked =)
if pkg.is_masked(use_changed = False) and not pkg.is_masked(use_changed = True):
- self.maskedCheck.set_label("<i>(Masked)</i>")
+ self.maskedCheck.set_label("<i>(%s)</i>" % _("Masked"))
self.maskedCheck.get_child().set_use_markup(True)
else:
- self.maskedCheck.set_label("Masked")
+ self.maskedCheck.set_label(_("Masked"))
if pkg.is_locally_masked():
- self.maskedCheck.set_label("<b>Masked</b>")
+ self.maskedCheck.set_label("<b>%s</b>" % _("Masked"))
self.maskedCheck.get_child().set_use_markup(True)
self.maskedCheck.set_active(True)
else:
self.maskedCheck.set_active(pkg.is_masked(use_changed = False))
if pkg.is_testing(use_keywords = False) and not pkg.is_testing(use_keywords = True):
- self.testingCheck.set_label("<i>(Testing)</i>")
+ self.testingCheck.set_label("<i>(%s)</i>" % _("Testing"))
self.testingCheck.get_child().set_use_markup(True)
else:
- self.testingCheck.set_label("Testing")
+ self.testingCheck.set_label(_("Testing"))
self.testingCheck.set_active(pkg.is_testing(use_keywords = False))
if self.doEmerge:
# set emerge-button-label
if not self.actual_package().is_installed():
- self.emergeBtn.set_label("E_merge")
+ self.emergeBtn.set_label(_("E_merge"))
self.unmergeBtn.set_sensitive(False)
else:
- self.emergeBtn.set_label("Re_merge")
+ self.emergeBtn.set_label(_("Re_merge"))
self.unmergeBtn.set_sensitive(True)
self.table.show_all()
@@ -819,12 +821,12 @@ class PackageTable:
if not self.actual_package().is_testing(use_keywords = True):
self.actual_package().set_testing(False)
- button.set_label("Testing")
+ button.set_label(_("Testing"))
button.set_active(True)
else:
self.actual_package().set_testing(True)
if self.actual_package().is_testing(use_keywords=False):
- button.set_label("<i>(Testing)</i>")
+ button.set_label("<i>(%s)</i>" % _("Testing"))
button.get_child().set_use_markup(True)
button.set_active(True)
@@ -847,21 +849,21 @@ class PackageTable:
if not pkg.is_masked(use_changed = True):
pkg.set_masked(True)
if pkg.is_locally_masked():
- button.set_label("<b>Masked</b>")
+ button.set_label("<b>%s</b>" % _("Masked"))
button.get_child().set_use_markup(True)
else:
- button.set_label("Masked")
+ button.set_label(_("Masked"))
button.set_active(True)
else:
locally = pkg.is_locally_masked()
pkg.set_masked(False)
if pkg.is_masked(use_changed=False) and not locally:
- button.set_label("<i>(Masked)</i>")
+ button.set_label("<i>(%s)</i>" % _("Masked"))
button.get_child().set_use_markup(True)
button.set_active(True)
else:
- button.set_label("Masked")
+ button.set_label(_("Masked"))
if self.instantChange:
self._update_keywords(True, update = True)
@@ -1062,10 +1064,10 @@ class MainWindow (Window):
self.queueList.set_model(store)
cell = gtk.CellRendererText()
- col = gtk.TreeViewColumn("Queue", cell, text = 0)
+ col = gtk.TreeViewColumn(_("Queue"), cell, text = 0)
self.queueList.append_column(col)
- col = gtk.TreeViewColumn("Options", cell, markup = 1)
+ col = gtk.TreeViewColumn(_("Options"), cell, markup = 1)
self.queueList.append_column(col)
self.useTips.add_view(self.queueList)
@@ -1083,7 +1085,7 @@ class MainWindow (Window):
self.catList.set_model(store)
cell = gtk.CellRendererText()
- col = gtk.TreeViewColumn("Categories", cell, text = 0)
+ col = gtk.TreeViewColumn(_("Categories"), cell, text = 0)
self.catList.append_column(col)
def build_pkg_list (self, name = None):
@@ -1098,7 +1100,7 @@ class MainWindow (Window):
# build view
self.pkgList.set_model(store)
- col = gtk.TreeViewColumn("Packages")
+ col = gtk.TreeViewColumn(_("Packages"))
col.set_clickable(True)
col.connect("clicked", self.cb_pkg_list_header_clicked)
@@ -1159,9 +1161,9 @@ class MainWindow (Window):
window_title_update(title)
if title is None:
- title = "Console"
+ title = _("Console")
else:
- title = ("Console (%s)" % title)
+ title = (_("Console (%(title)s)") % {"title" : title})
return False
diff --git a/portato/gui/gtk/wrapper.py b/portato/gui/gtk/wrapper.py
index bce4e07..dd06fac 100644
--- a/portato/gui/gtk/wrapper.py
+++ b/portato/gui/gtk/wrapper.py
@@ -33,13 +33,14 @@ class GtkTree (Tree):
string = ""
if oneshot:
- string += "<i>oneshot</i>"
+ string += "<i>%s</i>" % _("oneshot")
if update: string += "; "
if update:
- string += "<i>updating</i>"
if version is not None:
- string += "<i> from version %s</i>" % version
+ string += "<i>%s</i>" % (_("updating from version %s") % version)
+ else:
+ string += "<i>%s</i>" % _("updating")
return [cpv, string]
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index 5c26f58..062a5c3 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -236,7 +236,7 @@ class Database:
return inst+ninst
except KeyError: # cat is in category list - but not in portage
- info("Catched KeyError => %s seems not to be an available category. Have you played with rsync-excludes?", cat)
+ info(_("Catched KeyError => %s seems not to be an available category. Have you played with rsync-excludes?"), cat)
return []
def reload (self, cat):
diff --git a/portato/helper.py b/portato/helper.py
index d7a5366..abb91f9 100644
--- a/portato/helper.py
+++ b/portato/helper.py
@@ -22,6 +22,9 @@ warning = logging.getLogger("portatoLogger").warning
error = logging.getLogger("portatoLogger").error
critical = logging.getLogger("portatoLogger").critical
+def N_ (s):
+ return s
+
def set_log_level (lvl):
logging.getLogger("portatoLogger").setLevel(lvl)
diff --git a/portato/plugin.py b/portato/plugin.py
index ea11c3a..3b065b9 100644
--- a/portato/plugin.py
+++ b/portato/plugin.py
@@ -15,6 +15,7 @@
import os, os.path
from xml.dom.minidom import parse
from lxml import etree
+from gettext import lgettext as _
from constants import PLUGIN_DIR, XSD_LOCATION
from helper import *
@@ -283,18 +284,18 @@ class PluginQueue:
try:
mod = __import__(imp, globals(), locals(), [cmd.hook.call])
except ImportError:
- error("%s cannot be imported.", imp)
+ error(_("%s cannot be imported."), imp)
return
try:
f = eval("mod."+cmd.hook.call) # build function
except AttributeError:
- error("%s cannot be imported.", cmd.hook.call)
+ error(_("%s cannot be imported."), cmd.hook.call)
else:
try:
f = eval(cmd.hook.call)
except AttributeError:
- error("%s cannot be imported", cmd.hook.call)
+ error(_("%s cannot be imported."), cmd.hook.call)
return f(*hargs, **hkwargs) # call function
@@ -321,18 +322,18 @@ class PluginQueue:
# before
for cmd in list[0]:
- debug("Accessing hook '%s' of plugin '%s' (before).", hook, cmd.hook.plugin.name)
+ debug(_("Accessing hook '%(hook)s' of plugin '%(plugin)s' (before)."), {"hook" : hook, "plugin": cmd.hook.plugin.name})
call(cmd)
if list[1]: # override
- info("Overriding hook '%s' with plugin '%s'.", hook, list[1][0].hook.plugin.name)
+ info(_("Overriding hook '%(hook)s' with plugin '%(plugin)s'."), {"hook": hook, "plugin": list[1][0].hook.plugin.name})
ret = call(list[1][0])
else: # normal
ret = func(*args, **kwargs)
# after
for cmd in list[2]:
- debug("Accessing hook '%s' of plugin '%s' (after).", hook, cmd.hook.plugin.name)
+ debug(_("Accessing hook '%(hook)s' of plugin '%(plugin)s' (after)."), {"hook":hook, "plugin": cmd.hook.plugin.name})
call(cmd)
return ret
@@ -352,10 +353,10 @@ class PluginQueue:
try:
schema.assertValid(etree.parse(p))
except etree.XMLSyntaxError:
- error("Loading plugin '%s' failed. Invalid XML syntax.", p)
+ error(_("Loading plugin '%s' failed. Invalid XML syntax."), p)
continue
except etree.DocumentInvalid:
- error("Loading plugin '%s' failed. Plugin does not comply with schema.", p)
+ error(_("Loading plugin '%s' failed. Plugin does not comply with schema."), p)
continue
doc = parse(p)
@@ -384,10 +385,10 @@ class PluginQueue:
plugin.parse_options(elem.getElementsByTagName("options"))
self.list.append(plugin)
- info("Plugin '%s' loaded.", p)
+ info(_("Plugin '%s' loaded."), p)
except PluginImportException, e:
- error("Loading plugin '%s' failed: Could not import %s", p, e[0])
+ error(_("Loading plugin '%(plugin)s' failed: Could not import %(import)s"), {"plugin": p, "import": e[0]})
finally:
doc.unlink()
@@ -452,7 +453,7 @@ class PluginQueue:
# type = "override"
elif connect.is_override_type():
if self.hooks[hook.hook][1]:
- warn("For hook '%s' an override is already defined by plugin '%s'!", hook.hook, self.hooks[hook.hook][1][0])
+ warn(_("For hook '%(hook)s' an override is already defined by plugin '%(plugin)s'!"), {"hook": hook.hook, "plugin": self.hooks[hook.hook][1][0]})
self.hooks[hook.hook][1][:1] = [connect]
continue
@@ -483,7 +484,7 @@ class PluginQueue:
resolve(hook, list, idx, add)
for l in list:
- warn("Command for hook '%s' in plugin '%s' could not be added due to missing dependant: '%s'!", hook, l.hook.plugin.name, l.depend_plugin)
+ warn("Command for hook '%(hook)s' in plugin '%(plugin)s' could not be added due to missing dependant: '%(dep)s'!", {"hook": hook, "plugin": l.hook.plugin.name, "dep": l.depend_plugin})
for hook in before:
resolve(hook, before[hook], 0, 0)
diff --git a/portato/plugins/etc_proposals.py b/portato/plugins/etc_proposals.py
index e6c3187..81370e0 100644
--- a/portato/plugins/etc_proposals.py
+++ b/portato/plugins/etc_proposals.py
@@ -14,6 +14,7 @@ from portato.helper import *
from portato.backend import system
from subprocess import Popen
+from gettext import lgettext as _
from etcproposals.etcproposals_lib import EtcProposals, __version__
try:
@@ -60,7 +61,7 @@ def etc_prop (*args, **kwargs):
if f:
Popen([PROG, "--fastexit"]+f)
else:
- error("Cannot start etc-proposals. No graphical frontend installed!")
+ error(_("Cannot start etc-proposals. No graphical frontend installed!"))
def etc_prop_menu (*args, **kwargs):
if am_i_root():
@@ -72,6 +73,6 @@ def etc_prop_menu (*args, **kwargs):
if f:
Popen([PROG]+f)
else:
- error("Cannot start etc-proposals. No graphical frontend installed!")
+ error(_("Cannot start etc-proposals. No graphical frontend installed!"))
else:
- error("Cannot start etc-proposals. Not root!")
+ error(_("Cannot start etc-proposals. Not root!"))
diff --git a/portato/plugins/resume_loop.py b/portato/plugins/resume_loop.py
index b33f4c7..c4191a8 100644
--- a/portato/plugins/resume_loop.py
+++ b/portato/plugins/resume_loop.py
@@ -12,6 +12,7 @@
import pty, time
from subprocess import Popen, STDOUT
+from gettext import lgettext as _
from portato.backend import system
from portato.helper import debug, warning
@@ -26,7 +27,7 @@ def set_data (*args, **kwargs):
def resume_loop (retcode, *args, **kwargs):
if retcode is None:
- warning("Resume-loop called while process is still running!")
+ warning(_("Resume-loop called while process is still running!"))
elif retcode == 0:
# everything ok - ignore
#pass