From 4eb3e7c926d81d581e9a35559ae9aeb80f7bfe34 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Thu, 28 Feb 2013 18:56:59 +0000 Subject: [PATCH] GrampsLocale: Fix get_addon_translator path Add the locale subdirectory. Also clean out some cruft left over from the old implementation. svn: r21485 --- gramps/gen/utils/grampslocale.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/gramps/gen/utils/grampslocale.py b/gramps/gen/utils/grampslocale.py index 961cf6e3d..59497525a 100644 --- a/gramps/gen/utils/grampslocale.py +++ b/gramps/gen/utils/grampslocale.py @@ -408,7 +408,7 @@ class GrampsLocale(object): Get a translator for an addon. filename - filename of a file in directory with full path, or - None to get from running code + None to get from self. domain - the name of the .mo file under the LANG/LC_MESSAGES dir languages - a list of languages to force returns - a gettext.translation object @@ -420,20 +420,11 @@ class GrampsLocale(object): Assumes path/filename path/locale/LANG/LC_MESSAGES/addon.mo. """ - path = self.localedir - # If get the path of the calling module's uncompiled file. This seems a remarkably bad idea. -# if filename is None: -# filename = sys._getframe(1).f_code.co_filename - gramps_translator = self._get_translation() - path = os.path.dirname(os.path.abspath(filename)) - # Check if path is of type str. Do import and conversion if so. - # The import cannot be done at the top as that will conflict with the translation system. - - if not isinstance(path, UNITYPE) == str: - from .file import get_unicode_path_from_env_var - path = get_unicode_path_from_env_var(path) + path = self.localedir + if filename: + path = os.path.join(os.path.dirname(os.path.abspath(filename)), "locale") if languages: addon_translator = self._get_translation(domain, path,