Now able to generate the .po file as well if necessary

This commit is contained in:
Pierre Pronchery 2011-08-18 01:59:07 +00:00
parent 6eafacfedf
commit bee01ad801

View File

@ -63,13 +63,23 @@ _gettext_mo()
package="$1"
lang="$2"
_gettext_po "$package" "$lang" || return 1
$DEBUG $MSGFMT -c -v -o "$lang.mo" "$lang.po" || return 1
}
#gettext_po
_gettext_po()
{
package="$1"
lang="$2"
if [ -f "$lang.po" ]; then
$DEBUG $MSGMERGE -U "$lang.po" "$package.pot" || return 1
else
$DEBUG $MSGINIT -l "$lang" -o "$lang.po" -i "$package.pot" \
|| return 1
fi
$DEBUG $MSGFMT -c -v -o "$lang.mo" "$lang.po" || return 1
}
@ -115,6 +125,7 @@ LOCALEDIR="$PREFIX/share/locale"
while [ $# -gt 0 ]; do
target="$1"
lang="${target%%.mo}"
lang="${lang%%.po}"
shift
#uninstall
@ -129,6 +140,9 @@ while [ $# -gt 0 ]; do
*.mo)
_gettext_mo "$PACKAGE" "$lang" || exit 2
;;
*.po)
_gettext_po "$PACKAGE" "$lang" || exit 2
;;
*.pot)
_gettext_pot "${target%%.pot}" || exit 2
;;