#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/webmail-test-translation - test translation environment # # Copyright (c) 2001-2011 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2006-12-07 jed # Last Update: $Id$ # # Usage: webmail-test-translation [language-code][plugin-name][document-root][text-string] # - default language-code: de_DE # - default plugin name : squirrelmail # - default document-root: /var/www/htdocs/webmail # - default text string : All address books # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # set locale if [ "$1" = "" ] then testlang="de_DE" else testlang="$1" fi # set textdomain if [ "$2" = "" ] then textdomain="squirrelmail" else textdomain="$2" fi # set document root directory if [ "$3" = "" ] then docroot="/var/www/htdocs/webmail" else docroot="$3" fi # set text string for translation if [ "$4" = "" ] then textstring="All address books" else textstring="$4" fi # check if language specific entry exists if [ ! -f /usr/share/locale/locale.alias ] then echo "ERROR: file '/usr/share/locale/locale.alias' doesn't exist!" else echo "---locale.alias---" echo "COMMAND: grep \"${testlang}\" /usr/share/locale/locale.alias" grep "${testlang}" /usr/share/locale/locale.alias echo fi if [ ! -d /usr/lib/locale/${testlang} ] then echo "ERROR: directory '/usr/lib/locale/${testlang}' doesn't exist!" else echo "---directory------" echo "COMMAND: ls -ald /usr/lib/locale/${testlang}" echo "COMMAND: ls -al /usr/lib/locale/${testlang}/" ls -ald /usr/lib/locale/${testlang} ls -al /usr/lib/locale/${testlang} echo fi # check if squirrelmail language directory exists nodir=0 nofile=0 if [ ! -d ${docroot}/locale ] then echo "ERROR: directory '${docroot}/locale' doesn't exist!" nodir=1 fi if [ ! -d ${docroot}/locale/${testlang} ] then echo "ERROR: directory '${docroot}/locale/${testlang}' doesn't exist!" nodir=1 else # check if squirrelmail language translation file exists if [ ! -f ${docroot}/locale/${testlang}/LC_MESSAGES/${textdomain}.mo ] then echo "ERROR: file '${docroot}/locale/${testlang}/LC_MESSAGES/${textdomain}.mo' doesn't exist!" nofile=1 fi fi if [ ${nodir} -eq 0 -a ${nofile} -eq 0 ] then echo "---translation------" echo "COMMAND: TEXTDOMAINDIR=${docroot}/locale" echo "COMMAND: export TEXTDOMAINDIR" TEXTDOMAINDIR=${docroot}/locale export TEXTDOMAINDIR echo "COMMAND: TEXTDOMAIN=${textdomain}" echo "COMMAND: export TEXTDOMAIN" TEXTDOMAIN=${textdomain} export TEXTDOMAIN echo "COMMAND: LC_ALL=${testlang}" echo "COMMAND: export LC_ALL" LC_ALL=${testlang} export LC_ALL text=`gettext $TEXTDOMAIN "${textstring}"` # strace -o pltest.out gettext $TEXTDOMAIN "All address books" ret=$? echo "RESULT : locale: 'en_EN' -> '${testlang}'" echo "RESULT : translation '${textstring}' -> '${text}', Return:${ret}" fi