File: langpack-gettext

package info (click to toggle)
pypy3 7.3.11%2Bdfsg-2%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 201,024 kB
  • sloc: python: 1,950,308; ansic: 517,580; sh: 21,417; asm: 14,419; cpp: 4,263; makefile: 4,228; objc: 761; xml: 530; exp: 499; javascript: 314; pascal: 244; lisp: 45; csh: 11; awk: 4
file content (46 lines) | stat: -rw-r--r-- 1,446 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From: Stefano Rivera <stefanor@debian.org>
Date: Sat, 7 Oct 2017 09:38:58 +0200
Subject: Debian: 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/3/gettext.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib-python/3/gettext.py b/lib-python/3/gettext.py
index ae0c5f6..b7fdcbd 100644
--- a/lib-python/3/gettext.py
+++ b/lib-python/3/gettext.py
@@ -571,11 +571,26 @@ def find(domain, localedir=None, languages=None, all=False):
         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