505ce759 |
1 | #!/bin/sh |
2 | |
3 | # ** |
4 | # ** This script merges global PO to locale PO files. |
5 | # ** It creates a squirrelmail.po.new that have to |
6 | # ** be renamed to squirrelmail.po once before to |
7 | # ** compile the file. |
8 | # ** |
9 | # ** Usage: mergepo <locale id> |
10 | # ** Example: mergepo es |
11 | # ** |
12 | # ** Philipe Mingo <mingo@rotedic.com> |
13 | # ** Konstantin Riabitsev <icon@duke.edu> |
14 | # ** |
15 | # ** $Id$ |
16 | |
17 | if [ -z "$1" ]; then |
18 | echo "USAGE: mergepo [localename]" |
19 | exit 1 |
20 | fi |
21 | |
22 | WORKDIR=../locale |
23 | LOCALEDIR=$WORKDIR/$1 |
24 | |
25 | if [ ! -d $LOCALEDIR ]; then |
26 | # lessee if it's been renamed. |
27 | DCOUNT=`find $WORKDIR/ -name $1* | wc -l` |
28 | if [ $DCOUNT -eq 1 ]; then |
29 | # aha |
30 | LOCALEDIR=`find $WORKDIR/ -name $1*` |
31 | elif [ $DCOUNT -gt 1 ]; then |
32 | # err out |
33 | echo "More than one locale matching this name found:" |
34 | find $WORKDIR/ -name $1* |
35 | echo "You have to be more specific." |
36 | exit 1 |
37 | fi |
38 | fi |
39 | |
40 | echo "Merging $LOCALEDIR/LC_MESSAGES/squirrelmail.po" |
41 | mv $LOCALEDIR/LC_MESSAGES/squirrelmail.po \ |
42 | $LOCALEDIR/LC_MESSAGES/squirrelmail.po.bak |
43 | msgmerge $LOCALEDIR/LC_MESSAGES/squirrelmail.po.bak ../po/squirrelmail.po > \ |
44 | $LOCALEDIR/LC_MESSAGES/squirrelmail.po |
45 | echo "Old po file renamed to squirrelmail.po.bak " |