summaryrefslogtreecommitdiff
path: root/pocompile.sh
blob: 8eb9e314753b2bedfd816c412ef0e9a78b6534c7 (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
#!/bin/bash
# Helper script to compile all .po files in the i18n directroy into .mo files.

cd i18n

eme=""
if [[ "$1" == "-emerge" ]]; then
	eme="y"
	shift
fi

if [[ $# > 0 ]]; then
	langs="$@"
else
	langs="$(ls *.po | sed 's/\.po//g')"
fi

for lang in $langs; do
	item=${lang}.po

	if [[ -f $item ]]; then
		echo "Creating translation file for ${lang}."

		if [[ -n eme ]]; then
			mkdir mo -p
			msgfmt ${item} -o mo/${lang}.mo
		else
			mkdir ${lang}/LC_MESSAGES -p
			msgfmt ${item} -o ${lang}/LC_MESSAGES/portato.mo
		fi
	fi
done