GrampsLocale: Create GrampsTranslation attribute for language

Rather than relying on translators to correctly fill out po files

svn: r21526
This commit is contained in:
John Ralls 2013-03-02 20:25:07 +00:00
parent 67e975b31f
commit f6ab91e87f

View File

@ -275,10 +275,14 @@ class GrampsLocale(object):
if not localedir:
localedir = self.localedir
if gettext.find(domain, localedir, languages):
return gettext.translation(domain, localedir,
languages,
class_ = GrampsTranslations)
lang = gettext.find(domain, localedir, languages)
if lang:
translator = gettext.translation(domain, localedir,
languages,
class_ = GrampsTranslations)
translator._language = os.path.basename(os.path.dirname(os.path.dirname(lang))).split('.')[0]
return translator
else:
if not languages == ["en"]:
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 self.info()["language"]
return self._language
def gettext(self, msgid):
"""