#!/bin/bash # # Create translation catalogs on the system for all of the packages for which # we can find .mo files. # SOURCELOCALEDIRS="/usr/share/locale /usr/lib/locale" DESTLOCALEDIR=$DESTDIR/usr/share/locale DESTFILTERS= while [ $# -gt 0 ] ; do DESTFILTERS="$DESTFILTERS $1" shift done if [ -z "$DESTFILTERS" ] ; then echo Usage: `basename $0` 'filter [...]' fi exec < /dev/null PACKAGES=`find $SOURCELOCALEDIRS -name "*.mo" -print0 | xargs -0 -n1 basename | sed 's,.mo$,,g' | sort -u` for filter in $DESTFILTERS ; do destlocale=en_US@$filter test -d $DESTLOCALEDIR/$destlocale/LC_MESSAGES || \ mkdir -p $DESTLOCALEDIR/$destlocale/LC_MESSAGES done for package in $PACKAGES ; do sourcemo=`find $SOURCELOCALEDIRS -name $package.mo | head -n1` if test -n "$sourcemo" ; then echo -n $package for filter in $DESTFILTERS ; do destlocale=en_US@$filter msgunfmt $sourcemo | \ pomatic /dev/stdin $filter | \ msgfmt -o $DESTLOCALEDIR/$destlocale/LC_MESSAGES/$package.mo - && \ echo -n " $destlocale" done echo "" fi done for filter in $DESTFILTERS ; do destlocale=en_US@$filter test -d $DESTLOCALEDIR/$destlocale/LC_MESSAGES && \ rmdir $DESTLOCALEDIR/$destlocale/LC_MESSAGES 2> /dev/null done