Remove display system specific environment
[platform/framework/web/wrt.git] / po / update-po.sh
1 #!/bin/sh
2 # Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 #
4 #    Licensed under the Apache License, Version 2.0 (the "License");
5 #    you may not use this file except in compliance with the License.
6 #    You may obtain a copy of the License at
7 #
8 #        http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #    Unless required by applicable law or agreed to in writing, software
11 #    distributed under the License is distributed on an "AS IS" BASIS,
12 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #    See the License for the specific language governing permissions and
14 #    limitations under the License.
15 #
16
17 PACKAGE=wrt_engine_daemon
18 SRCROOT=..
19 POTFILES=POTFILES.in
20 ALL_SOURCE_FILES=`cd ..; find -name \*.h -o -name \*.cpp -o -name \*.c`
21 POTFILES_LIST=$(cd ..; grep "_(\""  ${ALL_SOURCE_FILES} -c | grep -v :0 | cut -d: -f1)
22 for i in $POTFILES_LIST
23 do
24     echo $i
25 done > $POTFILES
26
27 #ALL_LINGUAS= am az be ca cs da de el en_CA en_GB es et fi fr hr hu it ja ko lv mk ml ms nb ne nl pa pl pt pt_BR ru rw sk sl sr sr@Latn sv ta tr uk vi zh_CN zh_TW
28 ALL_LINGUAS="en_US en_GB ja ko zh_CN"
29
30 XGETTEXT=/usr/bin/xgettext
31 MSGMERGE=/usr/bin/msgmerge
32
33 echo -n "Make ${PACKAGE}.pot  "
34 if [ ! -e $POTFILES ] ; then
35         echo "$POTFILES not found"
36         exit 1
37 fi
38
39 $XGETTEXT --default-domain=${PACKAGE} --directory=${SRCROOT} \
40                 --add-comments --keyword=_ --keyword=N_ --files-from=$POTFILES \
41 && test ! -f ${PACKAGE}.po \
42         || (rm -f ${PACKAGE}.pot && mv ${PACKAGE}.po ${PACKAGE}.pot)
43
44 if [ $? -ne 0 ]; then
45         echo "error"
46         exit 1
47 else
48         echo "done"
49 fi
50
51 for LANG in $ALL_LINGUAS; do 
52         echo "$LANG : "
53
54         if [ ! -e $LANG.po ] ; then
55                 sed 's/CHARSET/UTF-8/g' ${PACKAGE}.pot > ${LANG}.po
56                 echo "${LANG}.po created"
57         else
58                 if $MSGMERGE ${LANG}.po ${PACKAGE}.pot -o ${LANG}.new.po ; then
59                         if cmp ${LANG}.po ${LANG}.new.po > /dev/null 2>&1; then
60                                 rm -f ${LANG}.new.po
61                         else
62                                 if mv -f ${LANG}.new.po ${LANG}.po; then
63                                         echo "" 
64                                 else
65                                         echo "msgmerge for $LANG.po failed: cannot move $LANG.new.po to $LANG.po" 1>&2
66                                         rm -f ${LANG}.new.po
67                                         exit 1
68                                 fi
69                         fi
70                 else
71                         echo "msgmerge for $LANG failed!"
72                         rm -f ${LANG}.new.po
73                 fi
74         fi
75         echo ""
76 done
77