summaryrefslogtreecommitdiffstats
path: root/scripts/inject-talkfilter-locales
blob: fe76f6c04b6f6b4407cedad38f5826ceabdfb171 (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
49
50
#!/bin/sh
#
#  Add translations for $po_filters for every .pot file in this tree, and if
#  we find what looks like autoconf scripts setting ALL_LINGUAS, add the
#  new translations to the list of languages.
#
po_filters="biffster chef drawl jive krad kraut l33t redneck valspeak"
quiet=false

exec < /dev/null

for arg in $@ ; do
	case "$arg" in
	--quiet) quiet=true ;;
	*) po_filters="$po_filters $arg" ;;
	esac
done

for filter in $po_filters ; do
	fakelang="en_US@$filter"

	found=false
	for potfile in `find . -name "*.pot"` ; do
		if test -r "$potfile" ; then
			subdir=`dirname $potfile`
			if ! $quiet ; then
				echo "Generating $fakelang translation."
			fi
			pomatic $potfile $filter > $subdir/$fakelang.po
			found=true
		fi
	done

	if ! $found ; then
		continue
	fi

	for script in `find . -name configure.in -o -name configure.ac -o -name configure` ; do
		if test -r $script ; then
			sed -e 's,^ALL_LINGUAS="\(.*\)",ALL_LINGUAS="\1 '"$fakelang"'",g' $script > $script.___spec_prep_post && \
			chmod --reference $script $script.___spec_prep_post && \
			touch -r $script $script.___spec_prep_post && \
			mv -f $script.___spec_prep_post $script && \
			$quiet || echo "Added $fakelang to ALL_LINGUAS in $script."
			if test -r $script.__spec_prep_post ; then
				rm -f $script.___spec_prep_post
			fi
		fi
	done
done