summaryrefslogtreecommitdiff
path: root/intl/gen-intl
diff options
context:
space:
mode:
Diffstat (limited to 'intl/gen-intl')
-rwxr-xr-xintl/gen-intl46
1 files changed, 46 insertions, 0 deletions
diff --git a/intl/gen-intl b/intl/gen-intl
new file mode 100755
index 0000000..e94297f
--- /dev/null
+++ b/intl/gen-intl
@@ -0,0 +1,46 @@
+#!/bin/sh
+LC_ALL=C
+export LC_ALL
+echo
+echo Generating language table.
+mangle_unprintable_command="`./mangle-unprintable`"
+languages=`cat index.txt|sed 's/ //g'`
+if [ -n "$languages" ]; then
+(
+n=0
+echo '/* Automatically generated by gen-intl */'
+for i in $languages; do
+ echo -n $i" " 1>&2
+ echo
+ echo 'static struct translation translation_'$i' [] = {'
+ echo ' { 0, NULL },'
+ cat $i.lng | eval "$mangle_unprintable_command" | sed 's/^/ {/' | sed 's/,[ ]*$/ },/'
+ echo ' { 0, NULL }'
+ echo '};'
+ n=`expr $n + 1`
+done
+echo
+echo 'static struct translation_desc translations [] = {'
+for i in $languages; do
+ echo ' { translation_'$i' },'
+done
+echo ' { NULL }'
+echo '};'
+echo
+(
+ echo '/* Automatically generated by gen-intl */'
+ echo
+ echo '#define N_LANGUAGES '$n
+ echo
+ cat english.lng | grep '^T_' | (cat; echo T__N_TEXTS) | sed 's/,.*//' | cat -n | sed 's/^\([^T]*\)\(.*\)$/#define \2 \1/'
+) | sed 's/ //g' > language.h
+) | sed 's/ //g' > ../language.inc
+if cmp -s ../language.h language.h; then
+ rm -f language.h
+else
+ mv language.h ..
+fi
+echo
+echo Done.
+fi
+echo