Updated gettext.sh (supports uninstalling the translations)
This commit is contained in:
parent
8a1fa555b6
commit
6e7b09d5d5
|
@ -12,6 +12,7 @@ MKDIR="mkdir -p"
|
||||||
MSGFMT="msgfmt"
|
MSGFMT="msgfmt"
|
||||||
MSGINIT="msginit"
|
MSGINIT="msginit"
|
||||||
MSGMERGE="msgmerge"
|
MSGMERGE="msgmerge"
|
||||||
|
RM="rm -f"
|
||||||
POTFILES="POTFILES"
|
POTFILES="POTFILES"
|
||||||
XGETTEXT="xgettext --force-po"
|
XGETTEXT="xgettext --force-po"
|
||||||
|
|
||||||
|
@ -20,7 +21,9 @@ XGETTEXT="xgettext --force-po"
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
echo "Usage: ./gettext.sh target" 1>&2
|
echo "Usage: ./gettext.sh <target>" 1>&2
|
||||||
|
echo " ./gettext.sh -p <prefix> install <target>" 1>&2
|
||||||
|
echo " ./gettext.sh -p <prefix> uninstall <target>" 1>&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,15 +63,24 @@ _gettext_pot()
|
||||||
|
|
||||||
|
|
||||||
#main
|
#main
|
||||||
if [ $# -eq 4 -a "$1" = "-p" -a "$3" = "install" ]; then
|
if [ $# -eq 4 -a "$1" = "-p" ]; then
|
||||||
PREFIX="$2"
|
PREFIX="$2"
|
||||||
LOCALEDIR="$PREFIX/share/locale"
|
LOCALEDIR="$PREFIX/share/locale"
|
||||||
lang="${4%%.mo}"
|
lang="${4%%.mo}"
|
||||||
|
|
||||||
|
if [ "$3" = "install" ]; then
|
||||||
$DEBUG $MKDIR "$LOCALEDIR/$lang/LC_MESSAGES" || exit 2
|
$DEBUG $MKDIR "$LOCALEDIR/$lang/LC_MESSAGES" || exit 2
|
||||||
$DEBUG $INSTALL "$4" "$LOCALEDIR/$lang/LC_MESSAGES/$PACKAGE.mo" \
|
$DEBUG $INSTALL "$4" \
|
||||||
|
"$LOCALEDIR/$lang/LC_MESSAGES/$PACKAGE.mo" \
|
||||||
|| exit 2
|
|| exit 2
|
||||||
exit 0
|
exit 0
|
||||||
|
elif [ "$3" = "uninstall" ]; then
|
||||||
|
$DEBUG $RM "$LOCALEDIR/$lang/LC_MESSAGES/$PACKAGE.mo" \
|
||||||
|
|| exit 2
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "gettext.sh: $3: Unknown operation" 1>&2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 1 ]; then
|
||||||
_usage
|
_usage
|
||||||
|
|
Loading…
Reference in New Issue
Block a user