1 |
#!/usr/bash |
#!/usr/bash |
2 |
|
|
|
# functions used for pootle |
|
|
|
|
3 |
diffmv() { |
diffmv() { |
4 |
if [ ! -z "$1" -a ! -z "$2" ] |
if [ ! -z "$1" -a ! -z "$2" ] |
5 |
then |
then |
6 |
if [ "${1%%.tm}" == "$1" ] |
if [ -f "$2" ] |
7 |
then |
then |
8 |
if diff -u "$2" "$1" |
if [ "${1%%.tm}" == "$1" ] |
9 |
then |
then |
10 |
/bin/rm -f "$1" |
if diff -u "$2" "$1" |
11 |
else |
then |
12 |
/bin/mv -f "$1" "$2" |
/bin/rm -f "$1" |
13 |
fi |
else |
14 |
else |
/bin/mv -f "$1" "$2" |
15 |
if diff -q "$2" "$1" > /dev/null |
fi |
16 |
then |
else |
17 |
/bin/rm -f "$1" |
if diff -q "$2" "$1" > /dev/null |
18 |
else |
then |
19 |
/bin/mv -f "$1" "$2" |
/bin/rm -f "$1" |
20 |
fi |
else |
21 |
fi |
/bin/mv -f "$1" "$2" |
22 |
|
fi |
23 |
|
fi |
24 |
|
else |
25 |
|
/bin/mv -f "$1" "$2" |
26 |
|
fi |
27 |
fi |
fi |
28 |
} |
} |
29 |
|
|
30 |
diffcp() { |
diffcp() { |
31 |
if [ ! -z "$1" -a ! -z "$2" ] |
if [ ! -z "$1" -a ! -z "$2" ] |
32 |
then |
then |
33 |
if [ "${1%%.tm}" == "$1" ] |
if [ -f "$2" ] |
34 |
then |
then |
35 |
if ! diff -u "$2" "$1" |
if [ "${1%%.tm}" == "$1" ] |
36 |
then |
then |
37 |
/bin/cp -a "$1" "$2" |
if ! diff -u "$2" "$1" |
38 |
fi |
then |
39 |
else |
/bin/cp -a "$1" "$2" |
40 |
if ! diff -q "$2" "$1" > /dev/null |
fi |
41 |
then |
else |
42 |
/bin/cp -a "$1" "$2" |
if ! diff -q "$2" "$1" > /dev/null |
43 |
fi |
then |
44 |
fi |
/bin/cp -a "$1" "$2" |
45 |
|
fi |
46 |
|
fi |
47 |
|
else |
48 |
|
/bin/cp -a "$1" "$2" |
49 |
|
fi |
50 |
fi |
fi |
51 |
} |
} |
52 |
|
|
53 |
potempl() { |
potempl() { |
54 |
xgettext -L perl -o - $@ \ |
xgettext --from-code UTF-8 -L perl -o - $@ \ |
55 |
| sed 's@charset=CHARSET@charset=UTF-8@;s@[^ ]*/root/@root/@g;s@Project-Id-Version.*\\n@Project-Id-Version: SME Console\\n@' \ |
| sed 's@charset=CHARSET@charset=UTF-8@;s@[^ ]*/root/@root/@g;s@Project-Id-Version.*\\n@Project-Id-Version: SME Console\\n@' \ |
56 |
| sed '/Report-Msgid-Bugs-To/d;/POT-Creation-Date/d;/PO-Revision-Date/d;/Language-Team/d;/X-Generator/d;0,/^msgid/{/^#/d}' \ |
| sed '/Report-Msgid-Bugs-To/d;/POT-Creation-Date/d;/PO-Revision-Date/d;/Language-Team/d;/X-Generator/d;0,/^msgid/{/^#/d}' \ |
57 |
| msgcat -F -t UTF-8 - |
| msgcat -F -t UTF-8 - |
85 |
-k=N_ \ |
-k=N_ \ |
86 |
-o - \ |
-o - \ |
87 |
$(sed -n '/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/etc/pootle/cvs/smeserver/\2/sme7/\2-*\3/\1@p' \ |
$(sed -n '/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/etc/pootle/cvs/smeserver/\2/sme7/\2-*\3/\1@p' \ |
88 |
/etc/pootle/cvs/smeserver/cdrom.image/updates/README.txt) \ |
/etc/pootle/cvs/smeserver/cdrom.image/sme7/updates/README.txt) \ |
89 |
/etc/pootle/cvs/smeserver/cdrom.image/updates/*.py \ |
$(sed -n '/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/etc/pootle/cvs/smeserver/\2/sme8/\2-*\3/\1@p' \ |
90 |
/etc/pootle/cvs/smeserver/cdrom.image/product/installclasses/*.py \ |
/etc/pootle/cvs/smeserver/cdrom.image/sme8/updates/README.txt) \ |
91 |
| sed 's@charset=CHARSET@charset=UTF-8@;s@[^ ]*/sme7/[^:]\+/\([^:]\+\):@updates/\1:@g;s@[^ ]*/cdrom.image/@@g;' \ |
/etc/pootle/cvs/smeserver/cdrom.image/sme7/updates/*.py \ |
92 |
| sed 's@Project-Id-Version.*\\n@Project-Id-Version: SME Anaconda\\n@' \ |
/etc/pootle/cvs/smeserver/cdrom.image/sme7/product/installclasses/*.py \ |
93 |
|
/etc/pootle/cvs/smeserver/cdrom.image/sme8/updates/*.py \ |
94 |
|
/etc/pootle/cvs/smeserver/cdrom.image/sme8/updates/installclasses/*.py \ |
95 |
|
| sed 's@charset=CHARSET@charset=UTF-8@;s@Project-Id-Version.*\\n@Project-Id-Version: SME Anaconda\\n@' \ |
96 |
|
| sed 's@/etc/pootle/cvs/smeserver/[^/]\+/@@' \ |
97 |
| msgcat -u \ |
| msgcat -u \ |
98 |
--use-first \ |
--use-first \ |
99 |
- \ |
- \ |
100 |
<(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/anaconda-*/po/anaconda.pot) \ |
<(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/anaconda-*/po/anaconda.pot) \ |
101 |
<(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/anaconda-*/po/anaconda.pot) \ |
<(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/anaconda-*/po/anaconda.pot) \ |
102 |
|
<(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme8/anaconda-*/po/anaconda.pot) \ |
103 |
|
<(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme8/anaconda-*/po/anaconda.pot) \ |
104 |
| sed '/Report-Msgid-Bugs-To/d;/POT-Creation-Date/d;/PO-Revision-Date/d;/Last-Translator/d;/Language-Team/d;/X-Generator/d;0,/^msgid/{/^#/d}' \ |
| sed '/Report-Msgid-Bugs-To/d;/POT-Creation-Date/d;/PO-Revision-Date/d;/Last-Translator/d;/Language-Team/d;/X-Generator/d;0,/^msgid/{/^#/d}' \ |
105 |
| msgcat -F -t UTF-8 - |
| msgcat -F -t UTF-8 - |
106 |
} |
} |
133 |
else |
else |
134 |
#lang=$(basename $(dirname $1)) |
#lang=$(basename $(dirname $1)) |
135 |
msgcat -F $1 \ |
msgcat -F $1 \ |
136 |
| perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g;s@\(n _}_ (\d+)\)@(n > $1)@' \ |
| perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g' \ |
137 |
|
| sed '/#,/d' | sed '1,/X-Generator/{;s,_{_,<,g;s,_}_,>,g;s,_AMP_,\&,g;}' \ |
138 |
| sed '/#,/d' \ |
| sed '/#,/d' \ |
139 |
| xml2po -m sme -p - /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@') \ |
| xml2po -m sme -p - /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@') \ |
140 |
| sed '1d' \ |
| sed '1d' \ |