Subversion Repositories LCARS

Compare Revisions

Last modification

Ignore whitespace Rev 157 → Rev 156

/trunk/styles/lcars.css
0,0 → 1,501
/*
* <title>CSS for PointedEars' LCARS, version 2.054, stardate 200712.02</title>
*/
 
/* basic fonts */
 
@font-face {
font-family: "Downloadable LCARS";
font-style: normal;
font-weight: normal;
src: url(fonts/LCARS.ttf);
}
 
/* EOT font created with WEFT on 2002-03-23 */
@font-face {
font-family: "Downloadable Haettenschweiler";
font-style: normal;
font-weight: normal;
src: url(fonts/HAETTEN0.eot), url(fonts/HAETTENS.ttf);
}
 
/*
@font-face {
font-family:Webdings;
font-style:normal;
font-weight:normal;
src:url(WEBDING0.eot);
}
*/
 
@font-face {
font-family: "Downloadable Zurich XCn BT";
font-style: normal;
font-weight: normal;
src: url(fonts/ZurichXCn.pfr);
}
 
/* basic display */
 
* {
font-family: LCARS, "Downloadable LCARS",
Haettenschweiler, "Downloadable Haettenschweiler",
"Zurich XCn BT", "Downloadable Zurich XCn BT",
impact, Verdana, Geneva, Arial, Helvetica, sans-serif;
font-weight: normal;
}
 
body {
cursor:default;
font-size:134%; /*129%*/
background-color:#000;
color:#ccf; /* #afbfe0; #69F; */
margin:0 10px;
/* IE 5.5+ scrollbar colors */
/* from Mozilla LCARS Theme (2D style) */
scrollbar-3dlight-color:#000;
scrollbar-arrow-color:#000;
scrollbar-base-color:#000;
scrollbar-darkshadow-color:#000;
scrollbar-face-color:#99f;
scrollbar-highlight-color:#99f;
scrollbar-track-color:#000;
scrollbar-shadow-color:#99f;
}
 
div.body {
/* width:95%; */
}
 
span.alt { /* span with alternative text color */
color:#f93;
background-color:#000;
}
 
/* for JavaScript processing messages */
 
.standby {
font-size:166%;
background-color:#000;
color:#99f;
}
 
div.standby {
position:absolute;
top:0;
visibility:hidden;
}
 
/* font styles */
 
p {
margin-top:0;
margin-bottom:1em;
}
 
div, p, li, th, td {
max-width: 60ex;
}
 
small {
font-size:100%;
}
 
b, strong {
color:#f93;
background-color:#000;
font-weight:normal;
}
 
i, cite, blockquote, em {
background-color:#000;
color:#f93;
font-style:normal;
}
 
abbr {
white-space:nowrap;
}
 
abbr, acronym {
border-bottom: 1px solid dotted;
cursor: help;
}
 
span.cap {
font-variant:small-caps;
}
 
/* headings */
 
h1 {
font-size:191%;
font-weight:normal;
color:#c96;
background-color:black;
}
 
 
h2 {
font-size:129%;
font-weight:normal;
color:#fc6;
background-color:black;
text-transform: uppercase;
}
 
h3 {
margin-top:0;
margin-bottom:1em;
font-size:123%;
font-weight:normal;
color:#fc6;
background-color:black;
text-transform: uppercase;
}
 
h4 {
margin-top:2em;
margin-bottom:1em;
font-size:116%;
font-weight:normal;
color:#fc6;
background-color:black;
}
 
table + h4 {
margin-top:1em;
}
 
a.h4:link:hover, a.h4:visited:hover {
color:#fc6;
background-color:black;
}
 
a.h4:link:active, a.h4:visited:active {
color:#fff;
background-color:black;
}
 
h5 {
margin-top:2em;
margin-bottom:1em;
font-size:111%;
font-weight:normal;
color:#fc6;
background-color:black;
}
 
h6 {
margin-top:2em;
margin-bottom:1em;
font-size:104%;
font-weight:normal;
color:#fc6;
background-color:black;
}
 
/* LCARS specific anchors */
 
/* order is important to buggy IE;
TODO: [IE] links focus color, visited links hover color */
 
a:link:hover, a:link:active, a:link:focus {
background-color:#000;
color:#fc0;
text-decoration:none;
}
 
a:link {
background-color:black;
color:white;
text-decoration:none;
}
 
a:visited:hover {
background-color:#000;
color:#fc3;
text-decoration:none;
}
 
a:visited:active {
background-color:black;
color:#fff;
text-decoration:none;
}
 
a:visited:focus {
background-color:#000;
color:#fc3;
text-decoration:none;
}
 
a:visited {
background-color:black;
color:#fc9;
text-decoration:none;
}
 
/* buttons */
 
a.button:link:focus, a.button:visited:focus,
a.button:link:hover, a.button:visited:hover {
color:#000;
background-color:#c9c;
text-decoration:none;
}
 
a.button:link:active, a.button:visited:active {
color:#000;
background-color:#fff;
cursor:default;
text-decoration:none;
}
 
a.button:link, a.button:visited {
background-color:#969;
color:#000;
padding-left:1px;
vertical-align:middle;
font-size:110%;
text-decoration:none;
}
 
a.stop:link, a.stop:visited {
background-color:#c66;
color:#000;
padding-left:1px;
vertical-align:middle;
font-size:110%;
text-decoration:none;
}
 
a.stop:link:hover, a.stop:visited:hover {
background-color:#f66;
color:#000;
text-decoration:none;
}
 
a.stop:link:active, a.stop:visited:active {
background-color:#fff;
color:#000;
text-decoration:none;
}
 
a.go:link, a.go:visited {
background-color:#6c6;
color:#000;
padding-left:1px;
vertical-align:middle;
font-size:110%;
text-decoration:none;
}
 
a.go:link:hover, a.go:visited:hover {
background-color:#6f6;
color:#000;
text-decoration:none;
}
 
a.go:link:active, a.go:visited:active {
background-color:#fff;
color:#000;
text-decoration:none;
}
 
span.symbol {
font-family:Webdings, fantasy;
font-style:normal;
font-weight:normal;
font-size:110%;
}
 
/* form elements */
 
input {
background-color:black;
font-size:104%;
color:white;
}
 
input.button {
/* offset-width:auto; */
border-style:none;
border-width:0px;
color:#000;
background-color:#969;
font-size:123%;
cursor:pointer;
}
 
textarea {
background-color:#000;
font-size:104%;
color:white;
}
 
select
{
color:white;
background-color:#000;
border-color:white;
font-size:104%;
cursor:pointer;
}
 
option {
cursor:pointer;
}
 
/* table elements */
 
table {
border-collapse: separate;
margin-top:0;
margin-bottom:1em;
}
 
/*
* Not for IE 6 and below.
* Bugfix for IE 7 is provided by lcars-ie7.css which should be
* included as follows:
<link rel="stylesheet" href="/styles/lcars.css" type="text/css">
<!--[if IE 7]>
<link rel="stylesheet" href="/styles/lcars-ie7.css" type="text/css">
<![endif]-->
*/
table>tbody.scroll {
height:11em;
overflow:auto;
/*
* In current implementations, the scrollbar is displayed within
* the tbody area, so we disable horizontal scrolling for that ...
*/
overflow-x: hidden !important;
}
 
table>tbody.scroll tr {
height: auto;
}
 
/*
* ... and make enough room so that the text won't flow under the
* vertical scrollbar. However, that is still a dirty hack as we
* assume that the vertical scrollbar is not wider than 20px.
*/
table>tbody.scroll td:last-child {
padding-right: 20px;
}
 
tr {
vertical-align:top;
vertical-align: baseline;
}
 
th {
padding-left:3px;
/* border-right:2px solid black; */
text-align:left;
background-color:#c66;
color:#000;
font-size: 133%;
font-weight:normal;
}
 
thead th:first-child {
padding-left: 12px;
border-radius: 12px 0 0 0;
-moz-border-radius: 12px 0 0 0;
-webkit-border-radius: 12px 0 0 0;
}
 
table.left th, thead.left th, tbody.left th, th.left {
background-color:inherit;
color:inherit;
text-transform:uppercase;
text-align:right;
}
 
th, td {
padding-right:3px;
}
 
td {
padding-left:4px;
background-color:inherit;
color:inherit;
font-size:133%;
}
 
/* hover table */
 
table.hover thead th:hover,
thead.hover th:hover,
tbody.hover th:hover,
table.hover tbody tr:hover th,
tbody.hover tr:hover th {
background-color:#f99;
color:#000;
}
 
table.hover tbody tr:hover,
tbody.hover tr:hover {
color:#fc3;
}
 
table.hover tbody tr:hover a,
tbody.hover tr:hover a {
background-color:inherit;
}
 
/* Lowlight all rows except that with the active/focused element */
table.hover tbody:active,
table.hover tbody:focus,
tbody.hover:active,
tbody.hover:focus {
background-color:#000;
color:#99c;
}
 
table.hover tbody tr:active,
tbody.hover tr:active,
table.hover tbody tr:focus,
tbody.hover tr:focus {
background-color:#000;
color:#fff;
}
 
/* This to invert display on hover does not seem proper LCARS design */
/*
table.hover tbody tr:hover a:link,
tbody.hover tr:hover a:link {
color:#fff;
}
 
table.hover tbody tr:hover a:visited,
tbody.hover tr:hover a:visited {
background-color:inherit;
color:#963;
}
 
table.hover tbody tr:hover a:link:focus,
table.hover tbody tr:hover a:visited:focus,
table.hover tbody tr:hover a:link:hover,
table.hover tbody tr:hover a:visited:hover,
table.hover tbody tr:hover a:link:active,
tbody.hover tr:hover a:link:focus,
tbody.hover tr:hover a:visited:focus,
tbody.hover tr:hover a:link:hover,
tbody.hover tr:hover a:visited:hover,
tbody.hover tr:hover a:link:active {
background-color:inherit;
color:#960;
}
 
table.hover tbody tr:hover a:visited:active,
tbody.hover tr:hover a:visited:active {
background-color:inherit;
color:#c63;
}
*/
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/tools/eazytrans/translate
===================================================================
--- trunk/tools/eazytrans/translate (nonexistent)
+++ trunk/tools/eazytrans/translate (revision 156)
@@ -0,0 +1,655 @@
+#!/bin/bash
+
+APPNAME="EazyTranslator"
+APPVER="0.97a"
+APPFILENAME=`basename $0`
+APPFILEDIR=`echo $0 | sed 's/'$APPFILENAME$'//'`
+
+# dictionary file
+DICT="$TRANSLATE_DIR"
+if [ -z "$DICT" ]; then DICT=$APPFILEDIR ; fi
+
+# delimiter name (for help page only) and character (string) for separating original expression
+# and translation in dictionary file
+DELIMITER_NAME="colon"
+DELIMITER=":"
+
+# all help on a single page
+SINGLE_PAGE=0
+
+# bell character
+CH_SOUND=""
+CH_SOUND_ON=$'\a'
+
+RESULT=""
+
+function title {
+ if [ $SINGLE_PAGE -eq 0 ]; then clear ; fi
+ echo
+ echo $APPNAME" "$APPVER" - Stream editor to use and to manage dictionary files"
+ echo "Requires 'basename', 'grep' and 'sed', optionally 'sort' and 'mktemp' in PATH"
+ echo
+}
+
+function copyright {
+ echo "Copyright (C) 2001 Thomas Lahn (webmaster@PointedEars.de)"
+ echo "Be sure to have 'easyTrans' or similar in mail subject line for fast response."
+ echo
+}
+
+function pause {
+ if [ "$1" == "c" ]; then
+ echo "Hit RETURN to continue..."
+ else
+ echo "Hit RETURN for the next page"
+ fi
+ read
+}
+
+function copying {
+ title
+ copyright
+ echo "This program is free software; you can redistribute it and/or modify"
+ echo "it under the terms of the GNU General Public License as published by"
+ echo "the Free Software Foundation; either version 2 of the License, or"
+ echo "(at your option) any later version."
+ echo
+ echo "This program is distributed in the hope that it will be useful,"
+ echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
+ echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
+ echo "GNU General Public License for more details."
+ echo
+ echo "You should have received a copy of the GNU General Public License"
+ echo "along with this program (COPYING file); if not, write to the"
+ echo "Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA."
+ echo
+}
+
+function cmdHelp {
+ title
+ echo $APPFILENAME" EXPRESSION DICTIONARY [OPTIONS]"
+ echo
+ echo "Tries to translate EXPRESSION looking up DICTIONARY and writes the result"
+ echo "to standard output (stdout) in a single line followed by a newline (\n)."
+ echo
+ echo "Environment:"
+ echo
+ echo "TRANSLATE_DIR Dictionary folder root (absolute path '/')"
+if [ -n "$TRANSLATE_DIR" ]; then
+ local INVALID_PATH=" -- INVALID PATH!"
+ local INVALID_FORMAT=" -- INVALID FORMAT!"
+ # : AutoCorrect performed!
+ local INVALID_MSG=""
+ if [ ! -e $TRANSLATE_DIR ]; then
+ INVALID_MSG=$INVALID_PATH
+ else
+ local GREPRES=`echo $TRANSLATE_DIR | grep -e "\/$"`
+ if [ -z "$GREPRES" ]; then INVALID_MSG=$INVALID_FORMAT ; fi
+ fi
+ echo " (currently '"$TRANSLATE_DIR"'"$INVALID_MSG")"
+ #if [ "$INVALID_MSG" == "$INVALID_FORMAT" ]; then
+ #export TRANSLATE_DIR=$TRANSLATE_DIR"/"
+ #set -a
+ #fi
+fi
+ echo " If undefined, this is the program directory"
+ echo " (currently '"$APPFILEDIR"')."
+ echo "TRANSLATE_OPTIONS Default options to overwrite command-line options"
+if [ -n "$TRANSLATE_OPTIONS" ]; then
+ echo " (currently '"$TRANSLATE_OPTIONS"')"
+fi
+ echo
+ echo "Arguments:"
+ echo
+ echo "EXPRESSION Word or (double-quoted) phrase to be translated"
+ echo "DICTIONARY Path of dictionary file relative to TRANSLATE_DIR"
+ echo
+ if [ $SINGLE_PAGE -eq 0 ]; then pause "c" ; fi
+ echo "Translation OPTIONS:"
+ echo " -b, --brackets If not in DICTIONARY, writes given WORD or EXPRESSION"
+ echo " as [WORD] or [EXPRESSION]."
+ echo " -m, --messages Return error messages instead of null-strings."
+ echo " -p, --phrase Translate EXPRESSION as entire phrase. If not given,"
+ echo " each WORD of EXPRESSION is translated seperately."
+ echo " -r, --reverse Perform reverse translation. Recommended only if"
+ echo " no appropriate dictionary file for vice-versa translation is"
+ echo " available and -p is also used."
+ echo " -s, --sound Beep on fatal errors."
+ echo " -v, --verbose Display flow of operation. Includes -m behavior."
+ echo " -z, --zero Return not translatable tokens as null-strings."
+ echo " Overwrites -b."
+ echo
+ if [ $SINGLE_PAGE -eq 0 ]; then pause "c" ; fi
+ echo $APPFILENAME" EXPRESSION DICTIONARY COMMAND TRANSLATION [INFO] [OPTIONS]"
+ echo $APPFILENAME" COMMAND DICTIONARY [INFO] [OPTIONS]"
+ echo
+ echo "Dictionary file COMMANDs:"
+ echo " -a, --add If not in DICTIONARY, add EXPRESSION with TRANSLATION"
+ echo " to DICTIONARY and write TRANSLATION."
+ echo " If DICTIONARY not exists, create the file with INFO"
+ echo " and add the entry; if INFO is a null-string,"
+ echo " default INFO is added, containing program version,"
+ echo " user name and timestamp. Requires 'sort'."
+ echo " -ai, --addinfo Add information data INFO to DICTIONARY."
+ echo " Must be used as first argument."
+ echo " -c, --create Create new DICTIONARY with INFO (see -a)."
+ echo " Existing files are replaced. Must be used as first argument."
+ echo " -d, --delete If used with EXPRESSION and DICTIONARY, remove EXPRESSION"
+ echo " from DICTIONARY instead of translating."
+ echo " If used as first argument, delete DICTIONARY."
+ echo " -i, --info Display information about DICTIONARY."
+ echo " Must be used as first argument."
+ echo
+ if [ $SINGLE_PAGE -eq 0 ]; then pause "c" ; fi
+ echo " -o, --overwrite Like -a but overwrite a contained translation of"
+ echo " EXPRESSION with TRANSLATION without question."
+ echo " Additionally requires 'mktemp'."
+ echo " -R, --repair Repair DICTIONARY instead of translating. Requires 'mktemp'."
+ echo " Info data is be kept but invalid entries are removed."
+ echo " USE WITH CAUTION!"
+ echo " -s, --sort Sort DICTIONARY instead of translating. Requires 'sort'."
+ echo " Includes --sound when used with -v."
+ echo " Must be used as first argument."
+ echo
+ if [ $SINGLE_PAGE -eq 0 ]; then pause "c" ; fi
+ echo $APPFILENAME" OPTION [OPTION]"
+ echo
+ echo "Help page OPTIONs:"
+ echo " --1 Display help on one page (without 'clear' and user input)."
+ echo " Useful with redirection "
+ echo " (try '"$APPFILENAME" --1 --? > translate.doc.txt')."
+ echo " Must be given before all other help page options."
+ echo " --a, --about Display information about the program."
+ echo " --c, --cmd Display this help page."
+ echo " --d, --dict Display help about dictionary files."
+ echo " --dev, --emp Display special information for developers and employers."
+ echo " --x, --example Display example."
+ echo " --?, --help Display all help pages."
+ echo
+}
+
+function example {
+ title
+ echo "EXAMPLE: If you would like to translate the English words 'a few' into German,"
+ echo
+ echo " "$APPFILENAME" ''a few'' en-de"
+ echo
+ echo "should write the German words"
+ echo
+ echo " ein(e) wenig(e)\n"
+ echo
+ echo "(without indent) to stdout if the echo dictionary file 'en-de' contains"
+ echo "a correct entry for it (see next page). You may also translate it as"
+ echo "entire phrase (which seems to make more sense here):"
+ echo
+ echo " "$APPFILENAME" ''a few'' en-de -p"
+ echo
+ echo "should instead write the German word 'einige\n'"
+ echo "(replace '' in input with the double-quote character)."
+ echo
+}
+
+function dictHelp {
+ title
+ echo "DICTIONARY FILES:"
+ echo "You may create/improve dictionary files to be used with "$APPNAME
+ echo "of your own. Translation data must match the following expression:"
+ echo
+ echo "#"$DELIMITER"File description displayed when option -i is used\n[#"$DELIMITER"File description\n]"
+ echo "[Expression"$DELIMITER"translation\n[Next expression"$DELIMITER"next translation\n]]"
+ echo "Last expression"$DELIMITER"last translation\z"
+ echo
+ echo "Parts enclosed in rectangle brackets are optional. The "$DELIMITER_NAME" ("$DELIMITER") is to be used"
+ echo "as delimiter character between original and translated expression only."
+ echo "Dictionary file names should contain common language identifiers separated"
+ echo "by a dash (such as 'en-de.dic' for an English-German dictionary file)."
+ echo
+ echo "Program updates and dictionaries can be obtained from"
+ echo "'http://pointedears.de/dev/unix/translate/'."
+ echo "Thank you for using a program by PointedEars."
+ echo
+}
+
+function devInfo {
+ title
+ copyright
+ echo "INFORMATION FOR DEVELOPERS (KNOWN ISSUES)..."
+ echo
+ echo "- Sorting the dictionary unfortunately also sorts its info data by now."
+ echo
+ echo "...AND FOR EMPLOYERS:"
+ echo
+ echo "BTW, if you have an idea for improving EasyTranslator or for another (field of)"
+ echo "application you want me to develop for you (BASIC, DOS batch, Windows INF,"
+ echo "Visual Basic, bash, Pascal, Delphi, C, HTML/JavaScript, and I am still learning"
+ echo "other languages) feel free to mail me, too. THNX! -- PointedEars, 2001-03-28"
+ echo
+}
+
+function help {
+ copying
+ if [ $SINGLE_PAGE -eq 0 ]; then pause ; fi
+ cmdHelp
+ if [ $SINGLE_PAGE -eq 0 ]; then pause ; fi
+ example
+ if [ $SINGLE_PAGE -eq 0 ]; then pause ; fi
+ dictHelp
+ if [ $SINGLE_PAGE -eq 0 ]; then pause ; fi
+ devInfo
+}
+
+function translateReverse {
+ local EXPR="$1"
+ if [ $VERBOSE -eq 1 ]; then echo "Executing: grep -i -e '"$DELIMITER$EXPR"$' '"$DICT"'" ; fi
+ RESULT=`grep -i -e "$DELIMITER$EXPR$" "$DICT"`
+ if [ $VERBOSE -eq 1 ]; then echo "grep returned: '"$RESULT"'" ; fi
+ if [ -n "$RESULT" ]; then
+ if [ $VERBOSE -eq 1 ]; then
+ echo "Reading expression from recordset (with sed requires only 1 step! :o)" ;
+ echo "Executing: echo $RESULT | sed 's/$DELIMITER[ ]*[^$DELIMITER]*//'"
+ fi
+ RESULT=`echo $RESULT | sed 's/'$DELIMITER'[ ]*[^'$DELIMITER']*//'`
+ if [ $VERBOSE -eq 1 ]; then echo "sed returned: '"$RESULT"'" ; fi
+ fi
+
+ # Should return only characters before the delimiter until BOL (expression)
+}
+
+function translate {
+ local EXPR="$1"
+ if [ $REVERSE -eq 1 ]; then translateReverse "$1" ; return ; fi
+ if [ $VERBOSE -eq 1 ]; then echo "Executing: grep -i -e '^"$EXPR$DELIMITER"' '"$DICT"'" ; fi
+ RESULT=`grep -i -e "^$EXPR$DELIMITER" "$DICT"`
+ if [ $VERBOSE -eq 1 ]; then echo "grep returned: '"$RESULT"'" ; fi
+ if [ -n "$RESULT" ]; then
+ if [ $VERBOSE -eq 1 ]; then
+ echo "Reading translation from recordset (with sed requires only 1 step! :o)" ;
+ echo "Executing: echo $RESULT | sed 's/[^$DELIMITER]*$DELIMITER[ ]*//'"
+ fi
+ RESULT=`echo $RESULT | sed 's/[^'$DELIMITER']*'$DELIMITER'[ ]*//'`
+ if [ $VERBOSE -eq 1 ]; then echo "sed returned: '"$RESULT"'" ; fi
+ fi
+
+ # Should return only characters after the separation character until EOL
+ # (translation)
+}
+
+# exit codes
+ESUCCESS=0
+ENO_DICT=1
+EDICT_DIR_NOT_FOUND=2
+EDICT_NOT_FOUND=3
+EDICT_WRONG_FORMAT=4
+EDICT_EXPR_CONTAINED=5
+EDICT_TEMP_ERROR=6
+EDICT_CREATE_ERROR=7
+EDICT_DELETE_EXPR_NOT_FOUND=8
+EDICT_REMOVE=9
+
+# argument flags
+DICTIONARY=0 # if 1, -d refers to the dictionary file instead of an entry
+
+# option flags - may be replaced by declare -i FLAG
+ADD=0
+ADDINFO=0
+BRACKETS=0
+CREATE=0
+DELETE=0
+INFO=0
+MESSAGES=0
+OVERWRITE=0
+PHRASE=0
+REPAIR=0
+REVERSE=0
+SORT=0
+SOUND=0
+VERBOSE=0
+ZERO=0
+
+if [ -n "$1" ]; then
+ # retrieve arguments and use default settings from environment variable
+ ARGUMENTS=$* ; if [ -n "$TRANSLATE_OPTIONS" ]; then ARGUMENTS=$ARGUMENTS" "$TRANSLATE_OPTIONS ; fi
+ # check options
+ for argument in $ARGUMENTS; do
+ case "$argument" in
+ "-b" | "--brackets") BRACKETS=1;;
+ "-m" | "--messages") MESSAGES=1;;
+ "-p" | "--phrase") PHRASE=1;;
+ "-r" | "--reverse") REVERSE=1;;
+ "-s" | "--sound") SOUND=1;;
+ "-v" | "--verbose") VERBOSE=1 ; title ; copyright;;
+ "-z" | "--zero") ZERO=1;;
+ "--a" | "--about") copying ; exit $ESUCCESS;;
+ "--c" | "--cmd") cmdHelp ; exit $ESUCCESS;;
+ "--d" | "--dict") dictHelp ; exit $ESUCCESS;;
+ "--dev" | "--emp") devInfo ; exit $ESUCCESS;;
+ "--1") SINGLE_PAGE=1;;
+ "--x" | "--example") example ; exit $ESUCCESS;;
+ "--?" | "--help") help ; exit $ESUCCESS;;
+ esac
+ done
+ if [ $SOUND -eq 1 ]; then CH_SOUND=$CH_SOUND_ON ; fi
+ if [ -n "$2" ]; then
+# concatenate dictionary root and given dictionary file
+ DICT="$DICT$2"
+# check for dictionary commands
+ case "$1" in
+ "-d" | "--delete") DELETE=1 ; DICTIONARY=1 ;;
+ "-c" | "--create") CREATE=1;;
+ "-i" | "--info") INFO=1;;
+ "-s" | "--sort") SORT=1;;
+ "-R" | "--repair") REPAIR=1;;
+ esac
+ case "$3" in
+ "-a" | "--add") ADD=1;;
+ "-ai" | "--addinfo") ADDINFO=1;;
+ "-d" | "--delete") DELETE=1;;
+ "-o" | "--overwrite") OVERWRITE=1;;
+ esac
+
+ if [ $VERBOSE -eq 1 ]; then
+ if [ -z "$TRANSLATE_DIR" ]; then
+ echo "Dictionary root (program directory): '"$APPFILEDIR"'"
+ else
+ echo "Dictionary root (TRANSLATE_DIR): '"$TRANSLATE_DIR"'"
+ fi
+ echo "Dictionary file: '"$2"'"
+ echo "Dictionary file path: '"$DICT"'"
+ fi
+
+ DEFAULT_INFO=$APPNAME" "$APPVER" dictionary file created by '"`whoami`"' on "`date`
+
+ if [ $CREATE -eq 1 ]; then
+ if [ $VERBOSE -eq 1 ]; then
+ echo $DICT": Creating dictionary"
+ fi
+ if [ -z "$3" ]; then
+ if [ $VERBOSE -eq 1 ]; then echo $DICT": Adding information: '"$DEFAULT_INFO ; fi
+ echo "#"$DELIMITER$EFAULT_INFO &>$DICT
+ else
+ if [ $VERBOSE -eq 1 ]; then echo $DICT": Adding information: '"$3"'" ; fi
+ echo "#"$DELIMITER$3 &>$DICT
+ fi
+ if [ $VERBOSE -eq 1 ]; then echo ; fi
+ exit $?
+ fi
+
+ if [ -e "$DICT" ]; then # if dictionary file exists
+ # check if dictionary file (contains at least '#$DELIMITER')
+ if [ $VERBOSE -eq 1 ]; then echo "Executing: grep -e '."$DELIMITER".' '"$DICT"'" ; fi
+ RESULT=`grep -e "#$DELIMITER." "$DICT"`
+ if [ -z "$RESULT" ]; then
+ if [ $VERBOSE -eq 1 ]; then echo "grep returned: ''" ; fi
+ echo $DICT": Not a (valid) dictionary file (type '"$APPFILENAME" --d' for details)."
+ if [ $VERBOSE -eq 1 ]; then echo ; fi
+ exit $EDICT_WRONG_FORMAT
+ else
+ if [ $VERBOSE -eq 1 ]; then
+ echo "grep returned not a null-string: '$DICT' seems to be a dictionary file"
+ fi
+ fi
+ RESULT=""
+
+ if [ $ADDINFO -eq 1 ]; then
+ if [ -z "$3" ]; then
+ if [ $VERBOSE -eq 1 ]; then echo $DICT": Adding information: '"$DEFAULT_INFO"'" ; fi
+ echo "#"$DELIMITER$DEFAULT_INFO >>$DICT
+ else
+ if [ $VERBOSE -eq 1 ]; then echo $DICT": Adding information: '"$3"'" ; fi
+ echo "#"$DELIMITER$3 >>$DICT
+ fi
+ if [ $VERBOSE -eq 1 ]; then echo ; fi
+ exit $?
+ fi
+
+ if [ $INFO -eq 1 ]; then
+ if [ $VERBOSE -eq 1 ]; then
+ echo "Obtaining information..."
+ echo
+ fi
+ grep "^#$DELIMITER" "$DICT" | sed 's/^#'$DELIMITER'//'
+ RESULT=`grep -e "^#$DELIMITER" "$DICT"`
+ if [ -z "$RESULT" ]; then echo $CH_SOUND$DICT": No information available" ; fi
+ if [ $VERBOSE -eq 1 ]; then echo ; fi
+ exit $ESUCCESS
+ fi
+
+ if [ $ADD -eq 1 ]; then
+ if [ $VERBOSE -eq 1 ]; then echo ; fi
+ RESULT=`grep -i -e "^$1$DELIMITER" "$DICT"`
+ if [ -z "$RESULT" ]; then
+ echo $DICT": Adding expression: '"$1"'"
+ echo $DICT": Adding translation: '"$4"'"
+ if [ -n "$4" ]; then
+ echo $1$DELIMITER$4 >>$DICT
+ else
+ if [ $MESSAGES -eq 1 ] || [ $VERBOSE -eq 1 ]; then echo $CH_SOUND$APPFILENAME": No translation given for '"$1"'" ; fi
+ fi
+ SORT=1
+ else
+ translate "$1"
+ echo $CH_SOUND$DICT": Expression already contained: '"$1"':"$RESULT
+ if [ $VERBOSE -eq 1 ]; then echo ; fi
+ exit $EDICT_EXPR_CONTAINED
+ fi
+ fi
+
+ if [ $OVERWRITE -eq 1 ]; then
+ if [ $VERBOSE -eq 1 ]; then echo ; fi
+ echo $DICT": Replacing expression: '"$1"'"
+ echo $DICT": Replacing translation: '"$4"'"
+ TMPFILE=`mktemp -q /tmp/$APPFILENAME.XXXXXX`
+ if [ $? -ne 0 ]; then
+ if [ $VERBOSE -eq 1 ]; then echo $APPFILENAME": Can't create temp file, exiting..." ; fi
+ exit EDICT_TEMP_ERROR
+ else
+ if [ -n "$4" ]; then
+ grep -iv -e "^$1$DELIMITER" "$DICT" &>$TMPFILE
+ if [ $? -eq 0 ]; then echo $1$DELIMITER$4 >>$TMPFILE ; fi
+ if [ $? -eq 0 ]; then mv $TMPFILE $DICT &>/dev/null ; fi
+ if [ $? -ne 0 ]; then
+ if [ $VERBOSE -eq 1 ]; then echo $APPFILENAME": Unable to replace dictionary file: '"$DICT"'" ; fi
+ exit EDICT_REPLACE_ERROR
+ else
+ SORT=1
+ fi
+ else
+ if [ $MESSAGES -eq 1 ] || [ $VERBOSE -eq 1 ]; then echo $CH_SOUND$APPFILENAME": No translation given for '"$1"'" ; fi
+ fi
+ fi
+ fi
+
+ if [ $DELETE -eq 1 ]; then
+ if [ $DICTIONARY -eq 0 ]; then
+ # delete entry
+ if [ $VERBOSE -eq 1 ]; then echo $DICT": Removing expression: "$1 ; fi
+ RESULT=`grep -i -e "^$1$DELIMITER" "$DICT"`
+ if [ -z "$RESULT" ]; then
+ if [ $MESSAGES -eq 1 ] || [ $VERBOSE -eq 1 ]; then echo $DICT": Expression not contained in dictionary: '"$1"'" ; fi
+ exit $EDICT_DELETE_EXPR_NOT_FOUND
+ fi
+ TMPFILE=`mktemp -q /tmp/$APPFILENAME.XXXXXX`
+ if [ $? -ne 0 ]; then
+ if [ $VERBOSE -eq 1 ]; then echo $APPFILENAME": Can't create temp file, exiting..." ; fi
+ exit EDICT_TEMP_ERROR
+ else
+ grep -iv -e "$1$DELIMITER" "$DICT" &>$TMPFILE
+ if [ $? -eq 0 ]; then mv $TMPFILE $DICT &>/dev/null ; fi
+ if [ $? -ne 0 ]; then
+ if [ $VERBOSE -eq 1 ]; then echo $DICT": Unable to modify dictionary (cannot replace file)" ; fi
+ exit EDICT_REPLACE_ERROR
+ else
+ if [ $VERBOSE -eq 1 ]; then echo $DICT": Modification successful" ; fi
+ exit $ESUCCESS
+ fi
+ fi
+ else
+ # delete dictionary
+ if [ $VERBOSE -eq 1 ]; then
+ echo $APPFILENAME": Deleting dictionary: '"$DICT"'"
+ echo $APPFILENAME": Executing: rm '"$DICT"' &>/dev/null"
+ fi
+ rm $DICT &>/dev/null
+ if [ $? -ne 0 ]; then
+ if [ $MESSAGES -eq 1 ] || [ $VERBOSE -eq 1 ]; then echo $DICT": Unable to remove dictionary" ; fi
+ exit $EDICT_REMOVE
+ else
+ if [ $VERBOSE -eq 1 ]; then
+ echo $DICT": Dictionary successfully removed"
+ echo
+ fi
+ exit $ESUCCESS
+ fi
+ fi
+ fi
+
+ if [ $SORT -eq 1 ]; then
+ if [ $VERBOSE -eq 1 ]; then
+ echo "Sorting vocabulary: '"$DICT"'"
+ echo "Executing: sort -d -f -o "$DICT" -t "$DELIMITER" "$DICT
+ fi
+ RESULT=`sort -d -f -o "$DICT" -t $DELIMITER "$DICT"`
+ SORT_EXIT=$?
+ if [ $VERBOSE -eq 1 ]; then
+ echo "sort returned exit code "$SORT_EXIT
+ if [ $SORT_EXIT -eq 0 ]; then
+ echo "Sorting successful: '"$DICT"'"
+ else
+ echo "Sorting failed: '"$DICT"'"
+ fi
+ echo
+ fi
+ exit $SORT_EXIT
+ fi
+
+ if [ $REPAIR -eq 1 ]; then
+ if [ $VERBOSE -eq 1 ]; then echo $DICT": Repairing dictionary" ; fi
+ TMPFILE=`mktemp -q /tmp/$APPFILENAME.XXXXXX`
+ if [ $? -ne 0 ]; then
+ if [ $VERBOSE -eq 1 ]; then echo $APPFILENAME": Can't create temp file, exiting..." ; fi
+ exit EDICT_TEMP_ERROR
+ else
+ grep -e "^#$DELIMITER" "$DICT" &>$TMPFILE
+ grep -e ".$DELIMITER." "$DICT" >>$TMPFILE
+ if [ $? -eq 0 ]; then mv $TMPFILE $DICT &>/dev/null ; fi
+ if [ $? -ne 0 ]; then
+ if [ $VERBOSE -eq 1 ]; then echo $DICT": Unable to repair dictionary (cannot replace file)" ; fi
+ exit EDICT_REPLACE_ERROR
+ else
+ $DICT": Repair successful"
+ fi
+ fi
+ fi
+
+ TRANSL=""
+ REVERSE_TRANSL=""
+ REVERSE_TRANSL_CAPT="T"
+ REVERSE_TRANSL_ON=" (reverse)"
+ REVERSE_TRANSL_CAPT_ON="Reverse t"
+ if [ $REVERSE -eq 1 ]; then
+ REVERSE_TRANSL=$REVERSE_TRANSL_ON
+ REVERSE_TRANSL_CAPT=$REVERSE_TRANSL_CAPT_ON
+ fi
+ if [ $PHRASE -eq 1 ] ; then
+ if [ $VERBOSE -eq 1 ]; then echo "Looking up phrase"$REVERSE_TRANSL": '"$1"'" ; fi
+ if [ $ZERO -eq 0 ]; then
+ TRANSL="$1" ; if [ $BRACKETS -eq 1 ]; then TRANSL="["$TRANSL"]" ; fi
+ fi
+ translate "$1"
+ if [ -n "$RESULT" ]; then
+ TRANSL=$RESULT
+ if [ $VERBOSE -eq 1 ]; then echo $REVERSE_TRANSL_CAPT"ranslation: '"$TRANSL"'" ; fi
+ else
+ if [ $VERBOSE -eq 1 ]; then
+ if [ $ZERO -eq 1 ]; then
+ echo $REVERSE_TRANSL_CAPT"ranslation failed (return not translatable tokens as null-string): '"$1"'"
+ else
+ if [ $BRACKETS -eq 1 ]; then
+ echo $CH_SOUND$REVERSE_TRANSL_CAPT"ranslation failed (enclosing phrase in brackets): '"$1"'"
+ else
+ echo $CH_SOUND$REVERSE_TRANSL_CAPT"ranslation failed (leave 'as is'): '"$1"'"
+ fi
+ fi
+ fi
+ fi
+ else
+ for word in $1; do
+ if [ $ZERO -eq 0 ]; then TRANSLWORD="$word" ; else TRANSLWORD="" ; fi
+ if [ $VERBOSE -eq 1 ]; then echo "Looking up word"$REVERSE_TRANSL": "$word ; fi
+ translate "$word"
+ if [ -n "$RESULT" ]; then
+ TRANSLWORD=$RESULT
+ if [ -n "$RESULT" ] && [ $VERBOSE -eq 1 ]; then echo $REVERSE_TRANSL_CAPT"ranslation: '"$TRANSLWORD"'" ; fi
+ else
+ if [ $ZERO -eq 0 ] && [ $BRACKETS -eq 1 ]; then TRANSLWORD="["$TRANSLWORD"]" ; fi
+ if [ $VERBOSE -eq 1 ]; then
+ if [ $ZERO -eq 1 ]; then
+ echo $REVERSE_TRANSL_CAPT"ranslation failed (return not translatable tokens as null-string): "$word
+ else
+ if [ $BRACKETS -eq 1 ]; then
+ echo $REVERSE_TRANSL_CAPT"ranslation failed (enclosing word in brackets): "$word
+ else
+ echo $REVERSE_TRANSL_CAPT"ranslation failed (leave 'as is'): "$word
+ fi
+ fi
+ fi
+ fi
+ TRANSL=$TRANSL" "$TRANSLWORD
+ done
+ fi
+ if [ $VERBOSE -eq 1 ]; then echo "Overall translation:" ; fi
+ if [ -n "$TRANSL" ]; then echo $TRANSL ; fi
+ if [ $VERBOSE -eq 1 ]; then echo ; fi
+ else
+ # send errmsg to stderr
+ if [ -n "$TRANSLATE_DIR" ] && [ ! -e "$TRANSLATE_DIR" ]; then
+ if [ $MESSAGES -eq 1 ] || [ $VERBOSE -eq 1 ]; then echo $CH_SOUND"$APPFILENAME: Unable to locate dictionary root: '"$TRANSLATE_DIR"'" 1>&2 ; fi
+ else
+ if [ $INFO -eq 0 ] && [ $ADD -eq 1 ] || [ $OVERWRITE -eq 1 ]; then
+ if [ $VERBOSE -eq 1 ]; then
+ echo
+ echo $DICT": Creating dictionary"
+ fi
+ if [ -n "$4" ]; then
+ if [ -z "$5" ]; then
+ if [ $VERBOSE -eq 1 ]; then echo $DICT": Adding information: '"$APPNAME" "$APPVER" dictionary file created by '"`whoami`"' on "`date`"'" ; fi
+ echo "#"$DELIMITER$APPNAME" "$APPVER" dictionary file created by '"`whoami`"' on "`date` &>$DICT
+ else
+ if [ $VERBOSE -eq 1 ]; then echo $DICT": Adding information: '"$5"'" ; fi
+ echo "#"$DELIMITER$5 &>$DICT
+ fi
+ if [ $? -eq 0 ]; then
+ if [ $VERBOSE -eq 1 ]; then
+ echo $DICT": Adding expression: '"$1"'"
+ echo $DICT": Adding translation: '"$4"'"
+ fi
+ echo $1$DELIMITER$4 >>$DICT
+ else
+ if [ $MESSAGES -eq 1 ] || [ $VERBOSE -eq 1 ]; then echo $CH_SOUND$APPFILENAME": Unable to create dictionary file: '"$DICT"'" ; fi
+ exit EDICT_CREATE_ERROR
+ fi
+ else
+ if [ $MESSAGES -eq 1 ] || [ $VERBOSE -eq 1 ]; then echo $CH_SOUND$APPFILENAME": No translation given for '"$1"'" ; fi
+ fi
+ else
+ if [ $MESSAGES -eq 1 ] || [ $VERBOSE -eq 1 ]; then echo $CH_SOUND$APPFILENAME": Unable to locate dictionary file: '"$DICT"' (please double-quote phrases)" 1>&2 ; fi
+ fi
+ fi
+ if [ $VERBOSE -eq 1 ]; then echo ; fi
+ if [ -n "$TRANSLATE_DIR" ] && [ ! -e "$TRANSLATE_DIR" ]; then
+ exit $EDICT_DIR_NOT_FOUND
+ else
+ exit $EDICT_NOT_FOUND
+ fi
+ fi
+ else
+ if [ $MESSAGES -eq 1 ] || [ $VERBOSE -eq 1 ]; then
+ # send errmsg to stderr
+ echo $CH_SOUND$APPFILENAME": No dictionary file given" 1>&2
+ fi
+ if [ $VERBOSE -eq 1 ]; then echo ; fi
+ exit $ENO_DICT
+ fi
+else
+ help
+fi
/trunk/tools/eazytrans/translate
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property