summaryrefslogtreecommitdiff
path: root/pocompile.sh
blob: 67374b7021ca2b5f7a3cf66a5b75f118d6433a77 (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
#!/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 
    # in emerge case do not install anything if nothing is given
    if [[ -z $eme ]]; then
	    langs="$(ls *.po | sed 's/\.po//g')"
    else
        langs=""
    fi
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