505ce759 |
1 | #!/bin/sh |
2 | |
3 | # ** |
4 | # ** This script merges global PO to locale PO files. |
48d94ae4 |
5 | # ** It creates a backup of the old PO file as squirrelmail.po.bak |
6 | # ** and puts the merged version in squirrelmail.po |
505ce759 |
7 | # ** |
8 | # ** Usage: mergepo <locale id> |
48d94ae4 |
9 | # ** Example: mergepo es_ES |
505ce759 |
10 | # ** |
11 | # ** Philipe Mingo <mingo@rotedic.com> |
12 | # ** Konstantin Riabitsev <icon@duke.edu> |
13 | # ** |
14 | # ** $Id$ |
15 | |
16 | if [ -z "$1" ]; then |
17 | echo "USAGE: mergepo [localename]" |
18 | exit 1 |
19 | fi |
20 | |
21 | WORKDIR=../locale |
22 | LOCALEDIR=$WORKDIR/$1 |
23 | |
24 | if [ ! -d $LOCALEDIR ]; then |
25 | # lessee if it's been renamed. |
26 | DCOUNT=`find $WORKDIR/ -name $1* | wc -l` |
27 | if [ $DCOUNT -eq 1 ]; then |
28 | # aha |
29 | LOCALEDIR=`find $WORKDIR/ -name $1*` |
30 | elif [ $DCOUNT -gt 1 ]; then |
31 | # err out |
32 | echo "More than one locale matching this name found:" |
33 | find $WORKDIR/ -name $1* |
34 | echo "You have to be more specific." |
35 | exit 1 |
36 | fi |
37 | fi |
38 | |
39 | echo "Merging $LOCALEDIR/LC_MESSAGES/squirrelmail.po" |
40 | mv $LOCALEDIR/LC_MESSAGES/squirrelmail.po \ |
41 | $LOCALEDIR/LC_MESSAGES/squirrelmail.po.bak |
42 | msgmerge $LOCALEDIR/LC_MESSAGES/squirrelmail.po.bak ../po/squirrelmail.po > \ |
43 | $LOCALEDIR/LC_MESSAGES/squirrelmail.po |
48d94ae4 |
44 | |
45 | # msgmerge will split long lines, such as the RCS Id line. If it did split |
46 | # it, join the pieces back together. |
47 | ed -s $LOCALEDIR/LC_MESSAGES/squirrelmail.po << END |
48 | /^"Project-Id-Version:/v/\\n"$/j\\ |
49 | s/""// |
50 | wq |
51 | END |
52 | |
53 | echo "Old po file renamed to squirrelmail.po.bak" |