l10n-configure.sh revision 12776
#
# This script modifies configure.in, .po files, po/Makefile.in.in and so on
# to configure l10n for Sun platforms. '--help' option shows the usage.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
PROG_VERSION=1.0
SUN_ALL_LINGUAS="cs de es fr hu it ja ko pl pt_BR ru sv zh_CN zh_HK zh_TW"
printf "This script modify ALL_LINGUAS parameter in configure.in file. \n"
printf "\n"
printf "usage: $PROGNAME Version $PROG_VERSION [OPTION...] \n"
printf " -c, --enable-copyright Modify po/Makefile.in.in and gnome-doc-utils.make\n"
printf " so that the copyright information is installed\n"
printf " from .po files. intltoolize and\n"
printf " gnome-doc-prepare need to be run before\n"
printf " this script is run if you run them.\n"
printf " -l, --enable-sun-linguas Modify ALL_LINGUAS for Sun translations.\n"
printf " -p, --enable-pot Generate .pot file for internal. \n"
printf " -x, --disable-gnu-extensions Remove GNU extensions in po/*.po files. \n"
printf " -h, --help Show this message. \n"
printf " -V, --version Show version. \n"
}
else
fi
if [ $? -ne 4 ] ; then
echo "#### Error: your getopt is not GNU getopt with the enhanced version."
echo "#### Please install SUNWgnugetopt"
exit 1
fi
ARGS=`$GETOPT -o chlpVx -l enable-copyright,help,usage,enable-sun-linguas,enable-pot,version,disable-gnu-extensions -n "$PROGNAME" -- "$@"`
eval set -- "$ARGS"
while [ $# -gt 0 ]
do
shift;;
echo $opt
exit 0;;
shift;;
L10N_POTFILES="yes"
shift;;
-V|--version)
echo $PROG_VERSION
exit 0;;
-x|--disable-gnu-extensions)
shift;;
--)
shift
break;;
*)
exit 1;;
esac
done
if [ -f configure.in ] ; then
elif [ -f configure.ac ] ; then
fi
}
echo "#### Not Found configure.in"
exit 0
fi
if [ ! -d po ] ; then
echo "#### Not Found po dir"
exit 0
fi
}
{
DQ='"'
DL='$'
GA='`'
BS='\\\'
if [ -f .sun-l10n-copyright ] ; then
return 0;
fi
if [ -f po/Makefile.in.in ] ; then
sed -e "/^install-data-yes: all/a\\
$DL(mkdir_p) $DL(DESTDIR)$DL(itlocaledir)\\
linguas=$DQ$DL(USE_LINGUAS)$DQ; $BS
for lang in $DL${DL}linguas; do $BS
dir=$DL(DESTDIR)$DL(itlocaledir)/$DL${DL}lang/LC_MESSAGES; $BS
$DL(mkdir_p) $DL${DL}dir; $BS
cat $DL${DL}lang.po | while read line; $BS
do $BS
is_comment=${GA}echo $DL${DL}line | grep '^#' | grep -v '^#,'$GA; $BS
break; $BS
fi; $BS
done; $BS
done" po/Makefile.in.in >> po/Makefile.in.in.$$
mv po/Makefile.in.in.$$ po/Makefile.in.in
fi
if [ -f gnome-doc-utils.make ] ; then
echo ${DQ}Copyright for $DL(DOC_MODULE)$DQ >> $DL(DESTDIR)/$DL(HELP_DIR)/$DL(DOC_MODULE)/$DL${DL}lc/copyright; ${BS}
do ${BS}
break; ${BS}
fi; ${BS}
echo $DQ$DL${DL}line$DQ | sed -e ${DQ}s/^#$BS(.*$BS)/ ${BS}1/$DQ >> $DL(DESTDIR)/$DL(HELP_DIR)/$DL(DOC_MODULE)/$DL${DL}lc/copyright; ${BS}
done; ${BS}
fi; ${BS}
done" gnome-doc-utils.make > gnome-doc-utils.make.$$
fi
touch .sun-l10n-copyright
return 0
}
# GNU .po has several GNU extensions.
disable_gnu_extensions () {
cd po
# Replace "%-m" with "%m" for strftime(3C).
# Replace "%l" with "%I" for strptime(3C) and also grep %M for the workaround
# so that we do not change %ld for printf(3C).
# Replace "%k" with "%H" for strptime(3C).
for po in `egrep -l \
'^msgstr ".*%[_0^-][md].*"|'\
'^msgstr "%I[doxXnfFeEgGaAcspCSm]"|'\
'^msgstr ".*%[_0^-]*l.*%[MpP].*"|'\
'^msgstr ".*%[MpP].*%[_0^-]*l.*"|'\
'^msgstr ".*%[_0^-]*k.*"'\
*.po`
do
env LANG=C LC_ALL=C \
env LANG=C LC_ALL=C \
env LANG=C LC_ALL=C \
env LANG=C LC_ALL=C \
env LANG=C LC_ALL=C \
done
cd ..
}
apply_sun_all_linguas_file () {
| uniq \
}
apply_sun_all_linguas_configure () {
ALL_LINGUAS=`echo "${ALL_LINGUAS} ${SUN_ALL_LINGUAS}"\
| sort \
| uniq \
DQ='"'
$SED -e "/^ALL_LINGUAS=/s/^\(ALL_LINGUAS=\)\(.*\)/\1$DQ${ALL_LINGUAS}$DQ/" \
$CONFIGURE > ${CONFIGURE}.chg
mv ${CONFIGURE}.chg $CONFIGURE
}
apply_sun_all_linguas () {
apply_sun_all_linguas_file
else
apply_sun_all_linguas_configure
fi
}
update_po () {
PO_DIRS=po*/POTFILES.in
for po in $PO_DIRS
do
#
# This is needed to avoid build errors.
#
done
}
update_pot () {
OS=`uname -s`
if [ "$OS" = Linux ] ; then
else
fi
POT_DATA='"POT-Creation-Date: '
cd po
rm -f *.pot
cat missing >> POTFILES.in
intltool-update --pot
mv ${POT}.$$ $POT
if [ -s ${POT}.diff ] ; then
echo "#### Translation should be updated!!!"
fi
else
fi
else
echo "#### Failed to create the potfile in `pwd`"
fi
cd ..
}
init $@
if [ $DISABLE_GNU_EXTENSIONS -eq 1 ] ; then
fi
if [ $ENABLE_SUN_ALL_LINGUAS -eq 1 ] ; then
fi
if [ $ENABLE_COPYRIGHT -eq 1 ] ; then
fi
fi
}
main $@