summaryrefslogtreecommitdiff
path: root/po/update-po.sh
blob: 42c1f257957d4c13b0cd02d3e85ff617d9b022d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
#
# Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
#
# This file is part of the native-installer
# Written by Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
# Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
#
# PROPRIETARY/CONFIDENTIAL
#
# This software is the confidential and proprietary information of
# SAMSUNG ELECTRONICS (Confidential Information).
# You shall not disclose such Confidential Information and shall
# use it only in accordance with the terms of the license agreement
# you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
# representations or warranties about the suitability
# of the software, either express or implied, including but not
# limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
# infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
# a result of using, modifying or distributing this software or its derivatives.
#


PACKAGE=factory-reset
SRCROOT=../src
POTFILES=POTFILES.in

#ALL_LINGUAS="ar az bg ca cs da de_DE el_GR en_PH en en_US es_ES es_MX et eu fi fr_CA fr_FR ga gl hi hr hu hy is it_IT ja_JP ka kk ko_KR lt lv mk nb nl_NL pl pt_BR pt_PT ro ru_RU sk sl sr sv tr_TR uk uz zh_CN zh_HK zh_SG zh_TW"
ALL_LINGUAS="as bn fa fil gu he id khmer kn lo ml mr ms my ne or pa sinhala sq ta te th ur vi"

XGETTEXT=/usr/bin/xgettext
MSGMERGE=/usr/bin/msgmerge

echo -n "Make ${PACKAGE}.pot  "
if [ ! -e $POTFILES ] ; then
	echo "$POTFILES not found"
	exit 1
fi

$XGETTEXT --default-domain=${PACKAGE} --directory=${SRCROOT} \
		--add-comments --keyword=_ --keyword=N_ --files-from=$POTFILES
if [ $? -ne 0 ]; then
	echo "xgettext error"
	exit 1
fi

if [ ! -f ${PACKAGE}.po ]; then
	echo "No such file: ${PACKAGE}.po"
	exit 1
fi

rm -f ${PACKAGE}.pot && mv ${PACKAGE}.po ${PACKAGE}.pot
echo "done"

for LANG in $ALL_LINGUAS; do
	echo "$LANG : "

	if [ ! -e $LANG.po ] ; then
		sed 's/CHARSET/UTF-8/g' ${PACKAGE}.pot > ${LANG}.po
		echo "${LANG}.po created"
	else
		if $MSGMERGE ${LANG}.po ${PACKAGE}.pot -o ${LANG}.new.po ; then
			if cmp ${LANG}.po ${LANG}.new.po > /dev/null 2>&1; then
				rm -f ${LANG}.new.po
			else
				if mv -f ${LANG}.new.po ${LANG}.po; then
					echo ""
				else
					echo "msgmerge for $LANG.po failed: cannot move $LANG.new.po to $LANG.po" 1>&2
					rm -f ${LANG}.new.po
					exit 1
				fi
			fi
		else
			echo "msgmerge for $LANG failed!"
			rm -f ${LANG}.new.po
		fi
	fi
	echo ""
done