translate-0.6/0000755000175000017500000000000010110640734012732 5ustar amsams00000000000000translate-0.6/translate.conf0000644000175000017500000000007707360063641015613 0ustar amsams00000000000000LANG=de-en GLOBDIR=/usr/share/trans DONT_ASK=false INVERS=falsetranslate-0.6/Makefile0000644000175000017500000000042107360407533014402 0ustar amsams00000000000000install: install -d debian/tmp/usr/bin cp translate debian/tmp/usr/bin install -d debian/tmp/etc cp translate.conf debian/tmp/etc install -d debian/tmp/usr/share/doc # gzip -9 -c debian/changelog > debian/tmp/usr/share/doc/changelog.Debian.gz clean: rm -f *~ translate-0.6/translate0000755000175000017500000000753607360064660014703 0ustar amsams00000000000000#!/bin/bash # # translate -- script for translating words # V0.5: Copyright(C) 1999 by Jochem Huhmann # Modified by Wolfgang Jährling # # translate 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, or (at your option) any # later version. # # translate is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with XEmacs; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. PATH=$PATH:/usr/bin # Built-in defaults VERSION=0.6 LOCDIR=~/.translate GLOBDIR=/usr/share/trans GLOBALCONF=/etc/translate.conf LOCALCONF=$LOCDIR/translate.conf LANG=de-en WHOLEWORD=false DONT_ASK=false INVERS=false # The help message usage () { echo " `basename $0` Version $VERSION 20/6/1999 joh@revier.com Looks up a word in a file with language-to-language translations (field separator should be \" :: \") and maintains local dictionaries. USAGE: `basename $0` [-niwvh] [-l languages] [words to translate] OPTIONS: -n non-interactive (don't prompt if no matches found) -i invers lookup (from second to first language) -w search only complete words -l languages to translate between -v display version and exit -h display this message EXAMPLE: `basename $0` -l de-en simplest " } invert_lang () { if [ $INVERS = true ] then INVERS=false else INVERS=true fi } wholeword () { if [ $WHOLEWORD = true ] then WHOLEWORD = false else WHOLEWORD = true fi } # If there is no $LOCDIR we should create one if [ ! -d $LOCDIR ] then echo -n "creating private folder $LOCDIR... " mkdir $LOCDIR && echo "OK." fi # Read configuration file, if any if [ -r $GLOBALCONF ] then . $GLOBALCONF fi if [ -r $LOCALCONF ] then . $LOCALCONF fi # Command line processing set -- `getopt "vhniwl:" "$@"` for i do case "$i" in -v) echo "`basename $0` Version $VERSION"; exit 0 ;; -w) WHOLEWORD=true ; shift;; -h) usage; exit 0 ;; -n) DONT_ASK=true; shift;; -i) invert_lang; shift;; -l) LANG=$2; shift; shift;; --) shift; break;; esac done if [ $# = 0 ] then usage; exit 1 fi # Finally we should know what language to use GLOBDIC=$GLOBDIR/$LANG LOCDIC=$LOCDIR/$LANG # Is there already a global dictionary for these languages # or should we rely on our own, private one? if [ -r $GLOBDIC ] then DIC="$GLOBDIC $LOCDIC" else echo "$GLOBDIC nicht richtig" if [ -r $LOCDIC ] then DIC=$LOCDIC echo "`basename $0`: Global dictionary $GLOBDIC does not exist or is not readable!" echo "`basename $0`: Fallback to $LOCDIC " echo "" fi fi # now get the real work done if if [ $WHOLEWORD = false ] then if [ $INVERS = false ] then egrep -ihs "$*".*' :: ' $DIC else egrep -ihs ' :: '.*"$*" $DIC fi else if [ $INVERS = false ] then egrep -wihs "$*".*' :: ' $DIC else egrep -wihs ' :: '.*"$*" $DIC fi fi then # Done exit 0 else # Fallback to human intelligence (unless "-n" is present) if [ $DONT_ASK = true ] then echo "Sorry \"$*\" not found" else echo "No matches. Teach me or press Return." echo -n "$* :: " read NEW_ENTRY if [ -z "$NEW_ENTRY" ] then # User is lazy exit 0 else # We've got a new entry if [ $INVERS = false ] then echo "$* :: $NEW_ENTRY" >> $LOCDIC else echo "$NEW_ENTRY :: $*" >> $LOCDIC fi exit 0 fi fi fi exit 0