aboutsummaryrefslogtreecommitdiffstats
path: root/tools/po-compile.sh
blob: a29d8cb0dd193794d715ed6e06b0ba63f8e9dc91 (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
#!/bin/sh

set -e

if test "$1" = "-h" -o "$1" = "--help"; then
	echo "Use: $0 [<language>]"
	echo "Run without arguments to compile all translation files."
	exit 0
fi

cd "$(readlink -f "$(dirname "$0")/..")"

update_mo(){
	echo $1
	language="$(basename "$1")"
	language="${language%.po}"
	target="$PWD/share/locale/$language/LC_MESSAGES/isodumper.mo"
	echo $target
	/bin/mkdir --parents "$(dirname "$target")"
	/usr/bin/msgfmt \
		--check \
		--output-file="$target" \
		"$1"
}

if test "$1"; then
  for l in $(find "$PWD/po" -type f -name "$1.po"); do
  echo $l
  update_mo "$l"
  done
else
  for l in $(find "$PWD/po" -type f -name '*.po'); do
    update_mo "$l"
  done
fi