Rev 15 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 15 | Rev 198 | ||
|---|---|---|---|
| 1 | 1 | ||
| 2 | EasyTranslator 0.95a - Stream editor to manage dictionary files |
2 | EasyTranslator 0.95a - Stream editor to manage dictionary files |
| 3 | Requires 'basename', 'grep' and 'sed', optionally 'sort' and 'mktemp' in PATH |
3 | Requires 'basename', 'grep' and 'sed', optionally 'sort' and 'mktemp' in PATH |
| 4 | 4 | ||
| 5 | Copyright (C) 2001 Thomas Lahn (webmaster@PointedEars.de) |
5 | Copyright (C) 2001 Thomas Lahn (webmaster@PointedEars.de) |
| 6 | Be sure to have 'easyTrans' or similar in mail subject line for fast response. |
6 | Be sure to have 'easyTrans' or similar in mail subject line for fast response. |
| 7 | 7 | ||
| 8 | This program is free software; you can redistribute it and/or modify |
8 | This program is free software; you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation; either version 2 of the License, or |
10 | the Free Software Foundation; either version 2 of the License, or |
| 11 | (at your option) any later version. |
11 | (at your option) any later version. |
| 12 | 12 | ||
| 13 | This program is distributed in the hope that it will be useful, |
13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
16 | GNU General Public License for more details. |
| 17 | 17 | ||
| 18 | You should have received a copy of the GNU General Public License |
18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program (COPYING file); if not, write to the |
19 | along with this program (COPYING file); if not, write to the |
| 20 | Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | EasyTranslator 0.95a - Stream editor to manage dictionary files |
23 | EasyTranslator 0.95a - Stream editor to manage dictionary files |
| 24 | Requires 'basename', 'grep' and 'sed', optionally 'sort' and 'mktemp' in PATH |
24 | Requires 'basename', 'grep' and 'sed', optionally 'sort' and 'mktemp' in PATH |
| 25 | 25 | ||
| 26 | translate EXPRESSION DICTIONARY [OPTIONS] |
26 | translate EXPRESSION DICTIONARY [OPTIONS] |
| 27 | 27 | ||
| 28 | Tries to translate EXPRESSION looking up DICTIONARY and writes the result |
28 | Tries to translate EXPRESSION looking up DICTIONARY and writes the result |
| 29 | to standard output (stdout) in a single line followed by a newline (\n). |
29 | to standard output (stdout) in a single line followed by a newline (\n). |
| 30 | 30 | ||
| 31 | Environment: |
31 | Environment: |
| 32 | 32 | ||
| 33 | TRANSLATE_DIR Dictionary folder root (absolute path '/') |
33 | TRANSLATE_DIR Dictionary folder root (absolute path '/') |
| 34 | If undefined, this is the program directory |
34 | If undefined, this is the program directory |
| 35 | (currently './'). |
35 | (currently './'). |
| 36 | TRANSLATE_OPTIONS Default options to overwrite command-line options |
36 | TRANSLATE_OPTIONS Default options to overwrite command-line options |
| 37 | 37 | ||
| 38 | Arguments: |
38 | Arguments: |
| 39 | 39 | ||
| 40 | EXPRESSION Word or (double-quoted) phrase to be translated |
40 | EXPRESSION Word or (double-quoted) phrase to be translated |
| 41 | DICTIONARY Path of dictionary file relative to TRANSLATE_DIR |
41 | DICTIONARY Path of dictionary file relative to TRANSLATE_DIR |
| 42 | 42 | ||
| 43 | Translation OPTIONS: |
43 | Translation OPTIONS: |
| 44 | -b, --brackets If not in DICTIONARY, writes given WORD or EXPRESSION |
44 | -b, --brackets If not in DICTIONARY, writes given WORD or EXPRESSION |
| 45 | as [WORD] or [EXPRESSION]. |
45 | as [WORD] or [EXPRESSION]. |
| 46 | -m, --messages Return error messages instead of null-strings. |
46 | -m, --messages Return error messages instead of null-strings. |
| 47 | -p, --phrase Translate EXPRESSION as entire phrase. If not given, |
47 | -p, --phrase Translate EXPRESSION as entire phrase. If not given, |
| 48 | each WORD of EXPRESSION is translated seperately. |
48 | each WORD of EXPRESSION is translated seperately. |
| 49 | -r, --reverse Perform reverse translation. Recommended only if |
49 | -r, --reverse Perform reverse translation. Recommended only if |
| 50 | no appropriate dictionary file for vice-versa translation is |
50 | no appropriate dictionary file for vice-versa translation is |
| 51 | available and -p is also used. |
51 | available and -p is also used. |
| 52 | -s, --sound Beep on fatal errors. |
52 | -s, --sound Beep on fatal errors. |
| 53 | -v, --verbose Display flow of operation. Includes -m behavior. |
53 | -v, --verbose Display flow of operation. Includes -m behavior. |
| 54 | -z, --zero Return not translatable tokens as null-strings. |
54 | -z, --zero Return not translatable tokens as null-strings. |
| 55 | Overwrites -b. |
55 | Overwrites -b. |
| 56 | 56 | ||
| 57 | translate EXPRESSION DICTIONARY COMMAND TRANSLATION [INFO] [OPTIONS] |
57 | translate EXPRESSION DICTIONARY COMMAND TRANSLATION [INFO] [OPTIONS] |
| 58 | translate COMMAND DICTIONARY [INFO] [OPTIONS] |
58 | translate COMMAND DICTIONARY [INFO] [OPTIONS] |
| 59 | 59 | ||
| 60 | Dictionary file COMMANDs: |
60 | Dictionary file COMMANDs: |
| 61 | -a, --add If not in DICTIONARY, add EXPRESSION with TRANSLATION |
61 | -a, --add If not in DICTIONARY, add EXPRESSION with TRANSLATION |
| 62 | to DICTIONARY and write TRANSLATION. |
62 | to DICTIONARY and write TRANSLATION. |
| 63 | If DICTIONARY not exists, create the file with INFO |
63 | If DICTIONARY not exists, create the file with INFO |
| 64 | and add the entry; if INFO is a null-string, |
64 | and add the entry; if INFO is a null-string, |
| 65 | default INFO is added, containing program version, |
65 | default INFO is added, containing program version, |
| 66 | user name and timestamp. Requires 'sort'. |
66 | user name and timestamp. Requires 'sort'. |
| 67 | -ai, -addinfo Add information data INFO to DICTIONARY. |
67 | -ai, -addinfo Add information data INFO to DICTIONARY. |
| 68 | Must be used as first argument. |
68 | Must be used as first argument. |
| 69 | -c, --create Create new DICTIONARY with INFO (see -a). |
69 | -c, --create Create new DICTIONARY with INFO (see -a). |
| 70 | Existing files are replaced. Must be used as first argument. |
70 | Existing files are replaced. Must be used as first argument. |
| 71 | -d, --delete If used with EXPRESSION and DICTIONARY, remove EXPRESSION |
71 | -d, --delete If used with EXPRESSION and DICTIONARY, remove EXPRESSION |
| 72 | from DICTIONARY instead of translating. |
72 | from DICTIONARY instead of translating. |
| 73 | If used as first argument, delete DICTIONARY. |
73 | If used as first argument, delete DICTIONARY. |
| 74 | -i, --info Display information about DICTIONARY. |
74 | -i, --info Display information about DICTIONARY. |
| 75 | Must be used as first argument. |
75 | Must be used as first argument. |
| 76 | 76 | ||
| 77 | -o, --overwrite Like -a but overwrite a contained translation of |
77 | -o, --overwrite Like -a but overwrite a contained translation of |
| 78 | EXPRESSION with TRANSLATION without question. |
78 | EXPRESSION with TRANSLATION without question. |
| 79 | Additionally requires 'mktemp'. |
79 | Additionally requires 'mktemp'. |
| 80 | -R, --repair Repair DICTIONARY instead of translating. Requires 'mktemp'. |
80 | -R, --repair Repair DICTIONARY instead of translating. Requires 'mktemp'. |
| 81 | Info data is be kept but invalid entries are removed. |
81 | Info data is be kept but invalid entries are removed. |
| 82 | USE WITH CAUTION! |
82 | USE WITH CAUTION! |
| 83 | -s, --sort Sort DICTIONARY instead of translating. Requires 'sort'. |
83 | -s, --sort Sort DICTIONARY instead of translating. Requires 'sort'. |
| 84 | Includes --sound when used with -v. |
84 | Includes --sound when used with -v. |
| 85 | Must be used as first argument. |
85 | Must be used as first argument. |
| 86 | 86 | ||
| 87 | translate OPTION [OPTION] |
87 | translate OPTION [OPTION] |
| 88 | 88 | ||
| 89 | Help page OPTIONs: |
89 | Help page OPTIONs: |
| 90 | --1 Display help on one page (without 'clear' and user input). |
90 | --1 Display help on one page (without 'clear' and user input). |
| 91 | Useful with redirection |
91 | Useful with redirection |
| 92 | (try 'translate --1 --? > translate.doc.txt'). |
92 | (try 'translate --1 --? > translate.doc.txt'). |
| 93 | Must be given before all other help page options. |
93 | Must be given before all other help page options. |
| 94 | --a, --about Display information about the program. |
94 | --a, --about Display information about the program. |
| 95 | --c, --cmd Display this help page. |
95 | --c, --cmd Display this help page. |
| 96 | --d, --dict Display help about dictionary files. |
96 | --d, --dict Display help about dictionary files. |
| 97 | --dev, --emp Display special information for developers and employers. |
97 | --dev, --emp Display special information for developers and employers. |
| 98 | --x, --example Display example. |
98 | --x, --example Display example. |
| 99 | --?, --help Display all help pages. |
99 | --?, --help Display all help pages. |
| 100 | 100 | ||
| 101 | 101 | ||
| 102 | EasyTranslator 0.95a - Stream editor to manage dictionary files |
102 | EasyTranslator 0.95a - Stream editor to manage dictionary files |
| 103 | Requires 'basename', 'grep' and 'sed', optionally 'sort' and 'mktemp' in PATH |
103 | Requires 'basename', 'grep' and 'sed', optionally 'sort' and 'mktemp' in PATH |
| 104 | 104 | ||
| 105 | EXAMPLE: If you would like to translate the English words 'a few' into German, |
105 | EXAMPLE: If you would like to translate the English words 'a few' into German, |
| 106 | 106 | ||
| 107 | translate ''a few'' en-de |
107 | translate ''a few'' en-de |
| 108 | 108 | ||
| 109 | should write the German words |
109 | should write the German words |
| 110 | 110 | ||
| 111 | ein(e) wenig(e)\n |
111 | ein(e) wenig(e)\n |
| 112 | 112 | ||
| 113 | (without indent) to stdout if the echo dictionary file 'en-de' contains |
113 | (without indent) to stdout if the echo dictionary file 'en-de' contains |
| 114 | a correct entry for it (see next page). You may also translate it as |
114 | a correct entry for it (see next page). You may also translate it as |
| 115 | entire phrase (which seems to make more sense here): |
115 | entire phrase (which seems to make more sense here): |
| 116 | 116 | ||
| 117 | translate ''a few'' en-de -p |
117 | translate ''a few'' en-de -p |
| 118 | 118 | ||
| 119 | should instead write the German word 'einige\n' |
119 | should instead write the German word 'einige\n' |
| 120 | (replace '' in input with the double-quote character). |
120 | (replace '' in input with the double-quote character). |
| 121 | 121 | ||
| 122 | 122 | ||
| 123 | EasyTranslator 0.95a - Stream editor to manage dictionary files |
123 | EasyTranslator 0.95a - Stream editor to manage dictionary files |
| 124 | Requires 'basename', 'grep' and 'sed', optionally 'sort' and 'mktemp' in PATH |
124 | Requires 'basename', 'grep' and 'sed', optionally 'sort' and 'mktemp' in PATH |
| 125 | 125 | ||
| 126 | DICTIONARY FILES: |
126 | DICTIONARY FILES: |
| 127 | You may create/improve dictionary files to be used with EasyTranslator |
127 | You may create/improve dictionary files to be used with EasyTranslator |
| 128 | of your own. Translation data must be contained therein as follows: |
128 | of your own. Translation data must be contained therein as follows: |
| 129 | 129 | ||
| 130 | #:File description displayed when option -i is used\n[#:File description\n] |
130 | #:File description displayed when option -i is used\n[#:File description\n] |
| 131 | [Expression:translation\n[Next expression:next translation\n]] |
131 | [Expression:translation\n[Next expression:next translation\n]] |
| 132 | Last expression:last translation\z |
132 | Last expression:last translation\z |
| 133 | 133 | ||
| 134 | Parts enclosed in rectangle brackets are optional. The colon (:) is to be used |
134 | Parts enclosed in rectangle brackets are optional. The colon (:) is to be used |
| 135 | as delimiter character between original and translated expression only. |
135 | as delimiter character between original and translated expression only. |
| 136 | Dictionary file names should contain common language identifiers separated |
136 | Dictionary file names should contain common language identifiers separated |
| 137 | by a dash (such as 'en-de.dic' for an English-German dictionary file). |
137 | by a dash (such as 'en-de.dic' for an English-German dictionary file). |
| 138 | 138 | ||
| 139 | Program updates and dictionaries can be obtained from |
139 | Program updates and dictionaries can be obtained from |
| 140 | 'http://pointedears.de/dev/unix/translate/'. |
140 | 'http://pointedears.de/dev/unix/translate/'. |
| 141 | Thank you for using a program by PointedEars. |
141 | Thank you for using a program by PointedEars. |
| 142 | 142 | ||
| 143 | 143 | ||
| 144 | EasyTranslator 0.95a - Stream editor to manage dictionary files |
144 | EasyTranslator 0.95a - Stream editor to manage dictionary files |
| 145 | Requires 'basename', 'grep' and 'sed', optionally 'sort' and 'mktemp' in PATH |
145 | Requires 'basename', 'grep' and 'sed', optionally 'sort' and 'mktemp' in PATH |
| 146 | 146 | ||
| 147 | Copyright (C) 2001 Thomas Lahn (webmaster@PointedEars.de) |
147 | Copyright (C) 2001 Thomas Lahn (webmaster@PointedEars.de) |
| 148 | Be sure to have 'easyTrans' or similar in mail subject line for fast response. |
148 | Be sure to have 'easyTrans' or similar in mail subject line for fast response. |
| 149 | 149 | ||
| 150 | INFORMATION FOR DEVELOPERS (KNOWN ISSUES)... |
150 | INFORMATION FOR DEVELOPERS (KNOWN ISSUES)... |
| 151 | 151 | ||
| 152 | 1) As I have not found out the correct /REGEXP/ for 'sed' to remove all |
152 | 1) As I have not found out the correct /REGEXP/ for 'sed' to remove all |
| 153 | characters before/after another one including this character (delimiter) |
153 | characters before/after another one including this character (delimiter) |
| 154 | to date, removing each single printable character before/after |
154 | to date, removing each single printable character before/after |
| 155 | delimiter is, for the time being, my only solution in bash. Please mail |
155 | delimiter is, for the time being, my only solution in bash. Please mail |
| 156 | me if you have a more efficient solution, especially the correct /REGEXP/. |
156 | me if you have a more efficient solution, especially the correct /REGEXP/. |
| 157 | 2) Sorting the dictionary unfortunately also sorts its the info data by now. |
157 | 2) Sorting the dictionary unfortunately also sorts its the info data by now. |
| 158 | 158 | ||
| 159 | ...AND FOR EMPLOYERS: |
159 | ...AND FOR EMPLOYERS: |
| 160 | 160 | ||
| 161 | BTW, if you have an idea for improving EasyTranslator or for another (field of) |
161 | BTW, if you have an idea for improving EasyTranslator or for another (field of) |
| 162 | application you want me to develop for you (BASIC, DOS batch, Windows INF, |
162 | application you want me to develop for you (BASIC, DOS batch, Windows INF, |
| 163 | Visual Basic, bash, Pascal, Delphi, C, HTML/JavaScript, and I am still learning |
163 | Visual Basic, bash, Pascal, Delphi, C, HTML/JavaScript, and I am still learning |
| 164 | other languages) feel free to mail me, too. THNX! -- PointedEars, 2001-03-28 |
164 | other languages) feel free to mail me, too. THNX! -- PointedEars, 2001-03-28 |
| 165 | 165 | ||