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 |
|
|
127 |
else |
else |
128 |
#lang=$(basename $(dirname $1)) |
#lang=$(basename $(dirname $1)) |
129 |
msgcat -F $1 \ |
msgcat -F $1 \ |
130 |
| perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g;s@\(n _}_ (\d+)\)@(n > $1)@' \ |
| perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g' \ |
131 |
|
| sed '/#,/d' | sed '1,/X-Generator/{;s,_{_,<,g;s,_}_,>,g;s,_AMP_,\&,g;}' \ |
132 |
| sed '/#,/d' \ |
| sed '/#,/d' \ |
133 |
| xml2po -m sme -p - /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@') \ |
| xml2po -m sme -p - /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@') \ |
134 |
| sed '1d' \ |
| sed '1d' \ |