[r21526]GrampsLocale: Create GrampsTranslation attribute for language

Rather than relying on translators to correctly fill out po files

svn: r21528
This commit is contained in:
John Ralls 2013-03-02 20:28:57 +00:00
parent 5a8a7479dd
commit 4ca0c9f8c9

View File

@ -275,10 +275,14 @@ class GrampsLocale(object):
if not localedir: if not localedir:
localedir = self.localedir localedir = self.localedir
if gettext.find(domain, localedir, languages): lang = gettext.find(domain, localedir, languages)
return gettext.translation(domain, localedir, if lang:
languages, translator = gettext.translation(domain, localedir,
class_ = GrampsTranslations) languages,
class_ = GrampsTranslations)
translator._language = os.path.basename(os.path.dirname(os.path.dirname(lang))).split('.')[0]
return translator
else: else:
if not languages == ["en"]: if not languages == ["en"]:
LOG.debug("Unable to find translations for %s and %s in %s", LOG.debug("Unable to find translations for %s and %s in %s",
@ -568,7 +572,7 @@ class GrampsTranslations(gettext.GNUTranslations):
""" """
Return the target languge of this translations object. Return the target languge of this translations object.
""" """
return self.info()["language"] return self._language
def gettext(self, msgid): def gettext(self, msgid):
""" """