repodb: Make error messages translatable
This commit is contained in:
+6
-2
@@ -10,6 +10,10 @@
|
|||||||
# Please read the COPYING file.
|
# Please read the COPYING file.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
|
_ = __trans.ugettext
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import piksemel
|
import piksemel
|
||||||
@@ -152,13 +156,13 @@ class RepoDB(lazydb.LazyDB):
|
|||||||
index_path = index_path.split(".bz2")[0]
|
index_path = index_path.split(".bz2")[0]
|
||||||
|
|
||||||
if not os.path.exists(index_path):
|
if not os.path.exists(index_path):
|
||||||
ctx.ui.warning("%s repository needs to be updated" % repo_name)
|
ctx.ui.warning(_("%s repository needs to be updated") % repo_name)
|
||||||
return piksemel.newDocument("PISI")
|
return piksemel.newDocument("PISI")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return piksemel.parse(index_path)
|
return piksemel.parse(index_path)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
raise RepoError("Error parsing repository index information. Index file does not exist or is malformed.")
|
raise RepoError(_("Error parsing repository index information. Index file does not exist or is malformed."))
|
||||||
|
|
||||||
def get_repo(self, repo):
|
def get_repo(self, repo):
|
||||||
return Repo(pisi.uri.URI(self.get_repo_url(repo)))
|
return Repo(pisi.uri.URI(self.get_repo_url(repo)))
|
||||||
|
|||||||
Reference in New Issue
Block a user