blob: f8482634184d68f247172f3dcb02f79c96bc81b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/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
|