#!/bin/sh # $Id$ ## # Shell script that synchronises all translations in phpMyAdmin ## # Any parameters (except --iconv/--recode) will be passed to grep to filter # processed translation, for example: './sync_lang.sh czech' will process only # czech translation, './sync_lang.sh -e czech -e english' will process czech # and english translations. ## # Written by Michal Cihar ## # Changes: # 2002-09-18 # * now accepts parameters --iconv/--recode for specifying which convertor # to use # 2002-08-13 # * support for synchronisation only for selected language(s) # 2002-07-18 # * can exclude some languages from conversion # 2002-07-17 # * support for multiple convertors (recode added) ## ## # convertor setup ## # CONVERTOR_PARAMS is used for printf and it also receives two params: source # and target charset # case "$1" in --iconv) echo Using iconv on user request CONVERTOR=iconv # the space on following is REQUIRED CONVERTOR_PARAMS=" -f %s -t %s" shift ;; --recode) echo Using recode on user request CONVERTOR=recode CONVERTOR_PARAMS="%s..%s" shift ;; *) echo Using recode as default, force with --iconv/--recode CONVERTOR=recode CONVERTOR_PARAMS="%s..%s" ;; esac ## # names of translations to process ## # Here should be listed all translations for which conversion should be done. # The name is filename without inc.php3. # BASE_TRANSLATIONS=`cat < $file echo done elif [ $src_charset = 'utf-8' ] ; then # if we convert from utf-8, we should remove allow_recoding $CONVERTOR $(printf "$CONVERTOR_PARAMS" $src_charset $charset) < $base.inc.php3| grep -v allow_recoding > $file echo done else # just convert $CONVERTOR $(printf "$CONVERTOR_PARAMS" $src_charset $charset) < $base.inc.php3| sed "s/$src_charset/$charset/" > $file echo done fi done # now check whether we found utf-8 translation if [ $is_utf = no ] ; then if ( echo $IGNORE_UTF | grep -q $base ) ; then # utf-8 should not be created true else # we should create utf-8 translation echo " creating utf-8 translation" charset=utf-8 iconv -f $src_charset -t $charset $base.inc.php3| sed -e "s/$src_charset/$charset/" -e '/\$charset/a\ $allow_recoding = TRUE;' > $lang-$charset.inc.php3 fi fi echo "$lang processing finished." echo "-------------------------------------------------------------------" done