aboutsummaryrefslogtreecommitdiffstats
path: root/fix_mo
blob: f853bdc4d8c1410fb70a07bead79325e153943d7 (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
#!/bin/sh
# Fix bad translations

# HP people wants to have 'Gnome' in ascii;
# so "±×³ð" is converted to 'GNOME'

KO_MESSAGES=$RPM_BUILD_ROOT/usr/share/locale/ko/LC_MESSAGES

TMP=$KO_MESSAGES/tmpfile
TMP2=$KO_MESSAGES/tmpfile2

ret=0

[ -f "$KO_MESSAGES/*.mo" ] || exit 0

for i in $KO_MESSAGES/*.mo ; do
    msgunfmt -o $TMP $i
    if grep -qi '^"Content-Type: text/plain; charset=euc-kr.n"$' $TMP; then
	sed 's:±×³ð:GNOME:g' < $TMP > $TMP2 && msgfmt -o $i $TMP2
	ret=$?
    elif grep -qi '^"Content-Type: text/plain; charset=utf-8.n"$' $TMP; then
	sed 's:그놈:GNOME:g' < $TMP > $TMP2 && msgfmt -o $i $TMP2
	ret=$?
    else
	echo "Unsupported encoding" 1>&2
    fi
done

rm -f $TMP $TMP2

exit $ret