Commit e2639c12 authored by bgm's avatar bgm

Added an option to generate only a .mo for a single language, + added help/usage.

parent 92e5e045
#!/bin/bash
langs=`ls -1d po/?? po/??_?? | cut -d/ -f2`
function usage() {
cat <<EOT
compile-mo-files.sh - compiles the .po files to binary .mo format
At runtime, gettext uses the compiled .mo format to translate strings (faster).
for lang in $langs; do
echo "compiling $lang"
Usage:
./bin/compile-mo-files.sh [locale]
Example:
./bin/compile-mo-files.sh
./bin/compile-mo-files.sh fr
EOT
exit 1;
}
function compile_po () {
lang=$1
echo -n "compiling $lang ... "
msgcat --use-first po/$lang/*.po | msgfmt -o po/$lang/civicrm.mo -
done
echo "done"
}
if [ "$1" = "--help" -o "$1" = "-h" ]; then
usage
fi
if [ -n "$1" ]; then
if [ -d "po/$1" ]; then
compile_po $1
else
echo "Error: $1: invalid locale (not found in the ./po/ directory)."
exit 1
fi
else
langs=`ls -1d po/?? po/??_?? | cut -d/ -f2`
for lang in $langs; do
compile_po $lang
done
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment