Only grab comments marked i18n to the template.
[squirrelmail.git] / po / mergepo
CommitLineData
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
16if [ -z "$1" ]; then
17 echo "USAGE: mergepo [localename]"
18 exit 1
19fi
20
21WORKDIR=../locale
22LOCALEDIR=$WORKDIR/$1
23
24if [ ! -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
37fi
38
39echo "Merging $LOCALEDIR/LC_MESSAGES/squirrelmail.po"
40mv $LOCALEDIR/LC_MESSAGES/squirrelmail.po \
41 $LOCALEDIR/LC_MESSAGES/squirrelmail.po.bak
de0ed34b 42msgmerge $LOCALEDIR/LC_MESSAGES/squirrelmail.po.bak ../po/squirrelmail.pot > \
505ce759 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.
47ed -s $LOCALEDIR/LC_MESSAGES/squirrelmail.po << END
48/^"Project-Id-Version:/v/\\n"$/j\\
49s/""//
50wq
51END
52
53echo "Old po file renamed to squirrelmail.po.bak"