File: i18n.sh

package info (click to toggle)
kshutdown 2.0beta9-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,232 kB
  • ctags: 432
  • sloc: cpp: 3,241; sh: 197; makefile: 5
file content (58 lines) | stat: -rwxr-xr-x 1,094 bytes parent folder | download | duplicates (4)
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
#!/bin/bash

if [ ! -f "./tools/i18n.sh" ]; then
	echo "Usage: ./tools/`basename $0`"
	exit 1
fi

# based on the Makagiga's tools/i18n.sh script

set -e

mkdir -p po

# remove generated "object" files
#rm -f po/*.mo
rm -f src/i18n/*.qm

# create list of all *.cpp and *.h files
find src -name "*.cpp" -or -name "*.h"|sort>po/list.tmp

# create translation template
xgettext \
	--files-from=po/list.tmp \
	--force-po \
	--keyword=i18n \
	--keyword=ki18n \
	--output=po/TEMPLATE.pot

# remove backups older than one week
find po -name "*.po*~" -mtime "+7" -delete

# merge "po/*.po"
for i in po/*.po; do
	if [ -f $i ]; then
		# create backup file
		cp "$i" "$i.`date "+%Y%m%d_%H%M_%S"`~"
		
		echo
		echo ">>> Creating $i translation..."
		msgmerge "$i" po/TEMPLATE.pot --output-file="$i"
		
#		echo "Creating KDE messages..."
#		msgfmt \
#			"$i" \
#			--output-file="po/$(basename "$i" .po).mo" \
#			--statistics

		echo "Creating Qt messages..."
		msgfmt \
			"$i" \
			--output-file="src/i18n/kshutdown_$(basename "$i" .po).qm" \
			--qt \
			--statistics
	fi
done

# clean up
rm po/list.tmp