langpack-gettext
authorMatthias Klose <doko@debian.org>
Sun, 16 Jan 2022 17:12:18 +0000 (17:12 +0000)
committerMatthias Klose <doko@debian.org>
Sun, 16 Jan 2022 17:12:18 +0000 (17:12 +0000)
# 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

# 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

Gbp-Pq: Name langpack-gettext.diff

Lib/gettext.py

index 77b67aef4204c909931d6eb1f75854324ef796a9..c869b8367abff2abd0a1e323e561e238741c6a26 100644 (file)
@@ -567,11 +567,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