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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#! /bin/sh -e
## langpack-gettext.dpatch by <michael.vogt@ubuntu.com>
#
# 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
#! /bin/sh /usr/share/dpatch/dpatch-run
## langpack-gettext.dpatch by <egon@localhost.localdomain>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Support language packs with pythons gettext implementation
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p1 < $0
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
;;
*)
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
exit 1
esac
exit 0
diff -urNad python2.4-2.4.3~/Lib/gettext.py python2.4-2.4.3/Lib/gettext.py
--- python2.4-2.4.3~/Lib/gettext.py 2004-07-22 20:44:01.000000000 +0200
+++ python2.4-2.4.3/Lib/gettext.py 2006-08-18 12:49:07.000000000 +0200
@@ -433,11 +433,26 @@
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
|