python/python-bundle-lang.patch
Jan Matejek a5bf6b85c9 Accepting request 129866 from home:dimstar:branches:devel:languages:python:Factory
gettext: also find locale files in /usr/share/bundle-locale. Fixes issues like bnc#617751, where bundle-lang-gnome-<xx> is installed, provides the .mo file, yet the python app does not translate. Installing <app>-lang would solve the issues, but would work against our bundle-lang package strategy... suggestive, this should also  be ported to 12.2

OBS-URL: https://build.opensuse.org/request/show/129866
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python?expand=0&rev=125
2012-08-06 16:21:50 +00:00

24 lines
939 B
Diff

Index: Python-2.7.3/Lib/gettext.py
===================================================================
--- Python-2.7.3.orig/Lib/gettext.py
+++ Python-2.7.3/Lib/gettext.py
@@ -56,6 +56,7 @@ __all__ = ['NullTranslations', 'GNUTrans
]
_default_localedir = os.path.join(sys.prefix, 'share', 'locale')
+_default_bundlelocaledir = os.path.join(sys.prefix, 'share', 'locale-bundle')
def test(condition, true, false):
@@ -420,6 +421,10 @@ class GNUTranslations(NullTranslations):
# Locate a .mo file using the gettext strategy
def find(domain, localedir=None, languages=None, all=0):
+ if localedir in [None, _default_localedir]:
+ bundle = find(domain, localedir=_default_bundlelocaledir, languages=languages, all=all)
+ if len(bundle):
+ return bundle
# Get some reasonable defaults for arguments that were not supplied
if localedir is None:
localedir = _default_localedir