summaryrefslogtreecommitdiff
path: root/debian/patches/langpack-gettext
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/langpack-gettext')
-rw-r--r--debian/patches/langpack-gettext46
1 files changed, 46 insertions, 0 deletions
diff --git a/debian/patches/langpack-gettext b/debian/patches/langpack-gettext
new file mode 100644
index 0000000..cd230fe
--- /dev/null
+++ b/debian/patches/langpack-gettext
@@ -0,0 +1,46 @@
+From: Stefano Rivera <stefanor@debian.org>
+Date: Sat, 7 Oct 2017 09:38:58 +0200
+Subject: Support Ubuntu langpacks
+
+Support alternative gettext tree in /usr/share/locale-langpack; if a
+file is present in both trees, prefer the newer one
+
+Forwarded: not-needed
+Origin: Debian cpython packaging
+Author: Michael Vogt <michael.vogt@ubuntu.com>
+Last-Update: 2011-12-19
+---
+ lib-python/2.7/gettext.py | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/lib-python/2.7/gettext.py b/lib-python/2.7/gettext.py
+index 765cc8c..b210f8d 100644
+--- a/lib-python/2.7/gettext.py
++++ b/lib-python/2.7/gettext.py
+@@ -522,11 +522,26 @@ def find(domain, localedir=None, languages=None, all=0):
+ if lang == 'C':
+ break
+ mofile = os.path.join(localedir, lang, 'LC_MESSAGES', '%s.mo' % domain)
++ mofile_lp = os.path.join("/usr/share/locale-langpack", lang,
++ 'LC_MESSAGES', '%s.mo' % domain)
++
++ # first look into the standard locale dir, then into the
++ # langpack locale dir
++
++ # standard mo file
+ if os.path.exists(mofile):
+ if all:
+ result.append(mofile)
+ else:
+ return mofile
++
++ # langpack mofile -> use it
++ if os.path.exists(mofile_lp):
++ if all:
++ result.append(mofile_lp)
++ else:
++ return mofile_lp
++
+ return result
+
+