1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#!/bin/sh
set -e
LOCALES_DIR="${DESTDIR}/usr/share/locale"
run() {
echo "$@"
"$@"
}
for filename in $(find po/ -name '*.po' -type f); do
language="$(basename "${filename}" .po)"
domain="$(basename "$(dirname "$filename")")"
output_dir="${LOCALES_DIR}/${language}/LC_MESSAGES"
output_file="${output_dir}/${domain}.mo"
if [ ! -d "${output_dir}" ]; then
run install -d -m 0755 "${output_dir}"
fi
# --endianness => Ensure consistent output even if built on a big-endian host
run msgfmt --statistics --endianness=little -c "${filename}" -o "${output_file}"
done
|