File: langpack-gettext.diff

package info (click to toggle)
python3.9 3.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 102,508 kB
  • sloc: python: 606,145; ansic: 515,486; xml: 31,209; sh: 4,917; cpp: 3,781; makefile: 1,885; asm: 1,486; objc: 761; lisp: 502; pascal: 360; javascript: 177; csh: 11
file content (34 lines) | stat: -rw-r--r-- 1,033 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
# DP: Description: support alternative gettext tree in
# DP: /usr/share/locale-langpack; if a file is present in both trees,
# DP: prefer the newer one
# DP: Upstream status: Ubuntu-Specific

--- a/Lib/gettext.py
+++ b/Lib/gettext.py
@@ -567,11 +567,26 @@ def find(domain, localedir=None, languag
         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