Mercurial > p > roundup > code
diff roundup/i18n.py @ 3350:73ef4805a2eb
search mo files relative ro roundup installation path [SF#1219689]
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Tue, 14 Jun 2005 05:33:32 +0000 |
| parents | a3d9d7e98c36 |
| children | 6e3e4f24c753 |
line wrap: on
line diff
--- a/roundup/i18n.py Wed Jun 08 03:47:09 2005 +0000 +++ b/roundup/i18n.py Tue Jun 14 05:33:32 2005 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: i18n.py,v 1.14 2004-11-17 07:18:27 a1s Exp $ +# $Id: i18n.py,v 1.15 2005-06-14 05:33:32 a1s Exp $ """ RoundUp Internationalization (I18N) @@ -43,6 +43,23 @@ from roundup import msgfmt +# List of directories for mo file search (see SF bug 1219689) +LOCALE_DIRS = [ + gettext_module._default_localedir, +] +# compute mo location relative to roundup installation directory +# (prefix/lib/python/site-packages/roundup/msgfmt.py on posix systems, +# prefix/lib/site-packages/roundup/msgfmt.py on windows). +# locale root is prefix/share/locale. +if os.name == "nt": + _mo_path = [".."] * 4 + ["share", "locale"] +else: + _mo_path = [".."] * 5 + ["share", "locale"] +_mo_path = os.path.normpath(os.path.join(msgfmt.__file__, *_mo_path)) +if _mo_path not in LOCALE_DIRS: + LOCALE_DIRS.append(_mo_path) +del _mo_path + # Roundup text domain DOMAIN = "roundup" @@ -170,7 +187,6 @@ """ mofiles = [] # locale directory paths - system_locale = gettext_module._default_localedir if tracker_home is None: tracker_locale = None else: @@ -180,14 +196,16 @@ # add mofiles found in the tracker, then in the system locale directory if tracker_locale: mofiles.append(get_mofile(locales, tracker_locale)) - mofiles.append(get_mofile(locales, system_locale, DOMAIN)) + for system_locale in LOCALE_DIRS: + mofiles.append(get_mofile(locales, system_locale, DOMAIN)) # we want to fall back to english unless english is selected language if "en" not in locales: locales = find_locales("en") # add mofiles found in the tracker, then in the system locale directory if tracker_locale: mofiles.append(get_mofile(locales, tracker_locale)) - mofiles.append(get_mofile(locales, system_locale, DOMAIN)) + for system_locale in LOCALE_DIRS: + mofiles.append(get_mofile(locales, system_locale, DOMAIN)) # filter out elements that are not found mofiles = filter(None, mofiles) if mofiles:
