def _category_translate(self, catname):
""" helper that will look into the categories we got from the
parser and returns the translated name if it find it,
otherwise it resorts to plain gettext
"""
# look into parsed categories that use .directory translation
for cat in self.all_categories:
if cat.untranslated_name == catname:
return cat.name
# try normal translation first
translated_catname = _(catname)
if translated_catname == catname:
# if no normal translation is found, try to find a escaped
# translation (LP: #872760)
translated_catname = _(GObject.markup_escape_text(catname))
# the parent expect the string unescaped
translated_catname = unescape(translated_catname)
return translated_catname
评论列表
文章目录