rev |
line source |
domcox@8451
|
1 ;;; text-translator-vars.el --- Text Translator
|
domcox@8451
|
2
|
domcox@8451
|
3 ;; Copyright (C) 2007-2010 khiker
|
domcox@8451
|
4
|
domcox@8451
|
5 ;; Author: khiker <khiker.mail+elisp@gmail.com>
|
domcox@8451
|
6 ;; plus <MLB33828@nifty.com>
|
domcox@8451
|
7
|
domcox@8451
|
8 ;; This file is free software; you can redistribute it and/or modify
|
domcox@8451
|
9 ;; it under the terms of the GNU General Public License as published by
|
domcox@8451
|
10 ;; the Free Software Foundation; either version 3, or (at your option)
|
domcox@8451
|
11 ;; any later version.
|
domcox@8451
|
12
|
domcox@8451
|
13 ;; This file is distributed in the hope that it will be useful,
|
domcox@8451
|
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
domcox@8451
|
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
domcox@8451
|
16 ;; GNU General Public License for more details.
|
domcox@8451
|
17
|
domcox@8451
|
18 ;; You should have received a copy of the GNU General Public License
|
domcox@8451
|
19 ;; along with GNU Emacs; see the file COPYING. If not, write to
|
domcox@8451
|
20 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
domcox@8451
|
21 ;; Boston, MA 02110-1301, USA.
|
domcox@8451
|
22
|
domcox@8451
|
23 ;;; Commentary:
|
domcox@8451
|
24
|
domcox@8451
|
25 ;; Variables for text-translator
|
domcox@8451
|
26
|
domcox@8451
|
27 ;;; Code:
|
domcox@8451
|
28
|
domcox@8451
|
29 (defconst text-translator-version "0.7.4"
|
domcox@8451
|
30 "version numbers of this version of text-translator")
|
domcox@8451
|
31
|
domcox@8451
|
32 (defconst text-translator-buffer "*translated*"
|
domcox@8451
|
33 "Buffer name that displays translation result.")
|
domcox@8451
|
34
|
domcox@8451
|
35 (defconst text-translator-mode-name "Translator"
|
domcox@8451
|
36 "Major mode name for displaying to mode line.")
|
domcox@8451
|
37
|
domcox@8451
|
38 (defconst text-translator-work-buffer (concat " " text-translator-buffer)
|
domcox@8451
|
39 "Output Buffer name from translation site.")
|
domcox@8451
|
40
|
domcox@8451
|
41 (defgroup text-translator nil
|
domcox@8451
|
42 "Text Translator"
|
domcox@8451
|
43 :tag "Text Translator"
|
domcox@8451
|
44 :group 'text-translator)
|
domcox@8451
|
45
|
domcox@8451
|
46 (defcustom text-translator-prefix-key "\C-c"
|
domcox@8451
|
47 "*Prefix key for text-translator commands."
|
domcox@8451
|
48 :tag "Prefix Key of text-translator"
|
domcox@8451
|
49 :type '(string :size 10)
|
domcox@8451
|
50 :group 'text-translator)
|
domcox@8451
|
51
|
domcox@8451
|
52 (defcustom text-translator-auto-window-adjust t
|
domcox@8451
|
53 "*Whether or not you adjust height of window displayed by dividing."
|
domcox@8451
|
54 :type 'boolean
|
domcox@8451
|
55 :group 'text-translator)
|
domcox@8451
|
56
|
domcox@8451
|
57 (defcustom text-translator-window-min-height 4
|
domcox@8451
|
58 "*Specify minimum height of the translation result display buffer."
|
domcox@8451
|
59 :type 'integer
|
domcox@8451
|
60 :group 'text-translator)
|
domcox@8451
|
61
|
domcox@8451
|
62 (defcustom text-translator-leave-string nil
|
domcox@8451
|
63 "*Whether or not you leave the character string before the translating."
|
domcox@8451
|
64 :type 'boolean
|
domcox@8451
|
65 :group 'text-translator)
|
domcox@8451
|
66
|
domcox@8451
|
67 (defcustom text-translator-pre-string-replace-alist
|
domcox@8451
|
68 '(("+" . "+") ("–" . "-") ("•" . "・"))
|
domcox@8451
|
69 "*Rule that converts character string that wants to translate."
|
domcox@8451
|
70 :type '(repeat
|
domcox@8451
|
71 (cons :tag "Rule"
|
domcox@8451
|
72 (string :tag "Letter before the converting.")
|
domcox@8451
|
73 (string :tag "Letter after the converting.")))
|
domcox@8451
|
74 :group 'text-translator)
|
domcox@8451
|
75
|
domcox@8451
|
76 (defcustom text-translator-post-string-replace-alist
|
domcox@8451
|
77 '(("\r" . "") ("'" . "'") (""" . "\"")
|
domcox@8451
|
78 ("&" . "&") ("<" . "<") (">" . ">") ("–" . "-")
|
domcox@8451
|
79 ("Ĉ" . "Ĉ") ("ĉ" . "ĉ") ("Ĝ" . "Ĝ") ("ĝ" . "ĝ")
|
domcox@8451
|
80 ("Ĥ" . "Ĥ") ("ĥ" . "ĥ") ("Ĵ" . "Ĵ") ("ĵ" . "ĵ")
|
domcox@8451
|
81 ("Ŝ" . "Ŝ") ("ŝ" . "ŝ") ("Ŭ" . "Ŭ") ("ŭ" . "ŭ"))
|
domcox@8451
|
82 "*Rule that converts character string after the translation."
|
domcox@8451
|
83 :type '(repeat
|
domcox@8451
|
84 (cons :tag "Rule"
|
domcox@8451
|
85 (string :tag "Letter before the converting.")
|
domcox@8451
|
86 (string :tag "Letter after the converting.")))
|
domcox@8451
|
87 :group 'text-translator)
|
domcox@8451
|
88
|
domcox@8451
|
89 (defcustom text-translator-proxy-server
|
domcox@8451
|
90 (let ((proxy (or (getenv "HTTP_PROXY") "")))
|
domcox@8451
|
91 (and (string-match "^\\(http://\\)?\\(.+\\):\\([0-9]+\\)" proxy)
|
domcox@8451
|
92 (match-string 2 proxy)))
|
domcox@8451
|
93 "*Proxy server used."
|
domcox@8451
|
94 :type '(choice (string :tag "specify proxy")
|
domcox@8451
|
95 (const :tag "not use proxy" nil))
|
domcox@8451
|
96 :group 'text-translator)
|
domcox@8451
|
97
|
domcox@8451
|
98 (defcustom text-translator-proxy-port
|
domcox@8451
|
99 (let ((proxy (or (getenv "HTTP_PROXY") "")))
|
domcox@8451
|
100 (or (and (string-match "^\\(http://\\)?\\(.+\\):\\([0-9]+\\)" proxy)
|
domcox@8451
|
101 (string-to-number (match-string 3 proxy)))
|
domcox@8451
|
102 8080))
|
domcox@8451
|
103 "*Proxy port number used."
|
domcox@8451
|
104 :type 'integer
|
domcox@8451
|
105 :group 'text-translator)
|
domcox@8451
|
106
|
domcox@8451
|
107 (defcustom text-translator-proxy-user nil
|
domcox@8451
|
108 "*Basic proxy authorization user name."
|
domcox@8451
|
109 :type '(choice (string :tag "Basic proxy authorization user name")
|
domcox@8451
|
110 (const :tag "Not use Basic proxy authorization" nil))
|
domcox@8451
|
111 :group 'text-translator)
|
domcox@8451
|
112
|
domcox@8451
|
113 (defcustom text-translator-proxy-password nil
|
domcox@8451
|
114 "*Basic proxy authorization password."
|
domcox@8451
|
115 :type '(choice (string :tag "Basic proxy authorization password")
|
domcox@8451
|
116 (const :tag "Not use Basic proxy authorization" nil))
|
domcox@8451
|
117 :group 'text-translator)
|
domcox@8451
|
118
|
domcox@8451
|
119 (defcustom text-translator-site-data-template-alist
|
domcox@8451
|
120 '(;; Google.com
|
domcox@8451
|
121 ("google.com"
|
domcox@8451
|
122 "translate.google.com"
|
domcox@8451
|
123 "/ HTTP/1.1"
|
domcox@8451
|
124 "js=n&prev=_t&hl=ja&ie=UTF-8&text=%s&file=&sl=%o&tl=%t"
|
domcox@8451
|
125 utf-8-dos
|
domcox@8451
|
126 (lambda ()
|
domcox@8451
|
127 (text-translator-extract-tag-exclusion-string
|
domcox@8451
|
128 "<span id=result_box[^>]*>\\(\\(<span [^>]*>\\([^<]\\|<br>\\)*</span>\\)+\\)</span>"))
|
domcox@8451
|
129 (("en" . "ja") ("ja" . "en")
|
domcox@8451
|
130 ("en" . "es") ("es" . "en")
|
domcox@8451
|
131 ("en" . "fr") ("fr" . "en")
|
domcox@8451
|
132 ("en" . "de") ("de" . "en")
|
domcox@8451
|
133 ("en" . "it") ("it" . "en")
|
domcox@8451
|
134 ("en" . "ar") ("ar" . "en")
|
domcox@8451
|
135 ("de" . "fr") ("fr" . "de")
|
domcox@8451
|
136 ("en" . "pt") ("pt" . "en")
|
domcox@8451
|
137 ("en" . "ru") ("ru" . "en")
|
domcox@8451
|
138 ("en" . "ko") ("ko" . "en")
|
domcox@8451
|
139 ("en" . "zh-CN") ("zh-CN" . "en")
|
domcox@8451
|
140 ("en" . "zh-TW") ("zh-TW" . "en")
|
domcox@8451
|
141 ("zh-CN" . "zh-TW") ("zh-TW" . "zh-CN"))
|
domcox@8451
|
142 (("zh-TW" . "tw") ("zh-CN" . "ch")))
|
domcox@8451
|
143
|
domcox@8451
|
144 ;; Yahoo.com
|
domcox@8451
|
145 ("yahoo.com"
|
domcox@8451
|
146 "babelfish.yahoo.com"
|
domcox@8451
|
147 "/translate_txt HTTP/1.1"
|
domcox@8451
|
148 "ei=UTF-8&doit=done&intl=1&tt=urltext&trtext=%s&lp=%o_%t&btnTrTxt=Translate"
|
domcox@8451
|
149 utf-8
|
domcox@8451
|
150 " <div id=\"result\"><div style=\"padding:0.6em;\">\\([^<]*\\)</div>"
|
domcox@8451
|
151 (("en" . "ja") ("ja" . "en")
|
domcox@8451
|
152 ("en" . "nl") ("nl" . "en")
|
domcox@8451
|
153 ("en" . "fr") ("fr" . "en")
|
domcox@8451
|
154 ("en" . "de") ("de" . "en")
|
domcox@8451
|
155 ("en" . "el") ("el" . "en")
|
domcox@8451
|
156 ("en" . "it") ("it" . "en")
|
domcox@8451
|
157 ("en" . "ko") ("ko" . "en")
|
domcox@8451
|
158 ("en" . "pt") ("pt" . "en")
|
domcox@8451
|
159 ("en" . "ru") ("ru" . "en")
|
domcox@8451
|
160 ("en" . "es") ("es" . "en")
|
domcox@8451
|
161 ("nl" . "fr")
|
domcox@8451
|
162 ("fr" . "de")
|
domcox@8451
|
163 ("fr" . "el") ("el" . "fr")
|
domcox@8451
|
164 ("fr" . "it") ("it" . "fr")
|
domcox@8451
|
165 ("fr" . "pt") ("pt" . "fr")
|
domcox@8451
|
166 ("fr" . "es") ("es" . "fr")
|
domcox@8451
|
167 ("en" . "zh") ("zh" . "en")
|
domcox@8451
|
168 ("en" . "zt") ("zt" . "en"))
|
domcox@8451
|
169 (("zh" . "ch") ("zt" . "tw")))
|
domcox@8451
|
170
|
domcox@8451
|
171 ;; Freetranslation.com
|
domcox@8451
|
172 ("freetranslation.com"
|
domcox@8451
|
173 "ets.freetranslation.com"
|
domcox@8451
|
174 "/ HTTP/1.1"
|
domcox@8451
|
175 "sequence=core&mode=html&charset=UTF-8&template=results_en-us.htm&language=%o/%t&srctext=%s"
|
domcox@8451
|
176 utf-8
|
domcox@8451
|
177 "<textarea name=\"dsttext\" cols=\"40\" rows=\"6\" style=\"width:99%;height:142px;\" id=\"resultsBox\">\\([^<]*\\)</textarea>"
|
domcox@8451
|
178 (("English" . "Spanish") ("Spanish" . "English")
|
domcox@8451
|
179 ("English" . "French") ("French" . "English")
|
domcox@8451
|
180 ("English" . "German") ("German" . "English")
|
domcox@8451
|
181 ("English" . "Italian") ("Italian" . "English")
|
domcox@8451
|
182 ("English" . "Dutch") ("Dutch" . "English")
|
domcox@8451
|
183 ("English" . "Portuguese") ("Portuguese" . "English")
|
domcox@8451
|
184 ("English" . "Norwegian"))
|
domcox@8451
|
185 (("English" . "en") ("Spanish" . "es")
|
domcox@8451
|
186 ("French" . "fr") ("German" . "de")
|
domcox@8451
|
187 ("Italian" . "it") ("Dutch" . "nl")
|
domcox@8451
|
188 ("Portuguese" . "pt") ("Norwegian" . "no")))
|
domcox@8451
|
189 ("freetranslation.com"
|
domcox@8451
|
190 "ets6.freetranslation.com"
|
domcox@8451
|
191 "/ HTTP/1.1"
|
domcox@8451
|
192 "sequence=core&mode=html&charset=UTF-8&template=results_en-us.htm&language=%o/%t&srctext=%s"
|
domcox@8451
|
193 utf-8
|
domcox@8451
|
194 "<textarea name=\"dsttext\" cols=\"40\" rows=\"6\" style=\"width:99%;height:142px;\" id=\"resultsBox\">\\([^<]*\\)</textarea>"
|
domcox@8451
|
195 (("English" . "Russian") ("Russian" . "English")
|
domcox@8451
|
196 ("English" . "SimplifiedChinese")
|
domcox@8451
|
197 ("English" . "TraditionalChinese"))
|
domcox@8451
|
198 (("English" . "en") ("Russian" . "ru")
|
domcox@8451
|
199 ("SimplifiedChinese" . "ch") ("TraditionalChinese" . "tw")))
|
domcox@8451
|
200 ("freetranslation.com"
|
domcox@8451
|
201 "tets9.freetranslation.com"
|
domcox@8451
|
202 "/ HTTP/1.1"
|
domcox@8451
|
203 "sequence=core&mode=html&charset=UTF-8&template=results_en-us.htm&language=%o/%t&srctext=%s"
|
domcox@8451
|
204 utf-8
|
domcox@8451
|
205 "<textarea name=\"dsttext\" cols=\"40\" rows=\"6\" style=\"width:99%;height:142px;\" id=\"resultsBox\">\\([^<]*\\)</textarea>"
|
domcox@8451
|
206 (("English" . "Japanese") ("Japanese" . "English"))
|
domcox@8451
|
207 (("English" . "en") ("Japanese" . "ja")))
|
domcox@8451
|
208
|
domcox@8451
|
209 ;; Livedoor.com
|
domcox@8451
|
210 ("livedoor.com"
|
domcox@8451
|
211 "translate.livedoor.com"
|
domcox@8451
|
212 "/ HTTP/1.1"
|
domcox@8451
|
213 "clear_flg=1&src_text=%s&trns_type=%o,%t&sumit=翻訳"
|
domcox@8451
|
214 utf-8
|
domcox@8451
|
215 "<textarea name=\"tar_text\" cols=\"40\" rows=\"10\" wrap=\"physical\">\\([^<]*\\)</textarea>"
|
domcox@8451
|
216 (("1" . "2") ("2" . "1")
|
domcox@8451
|
217 ("2" . "9") ("9" . "2")
|
domcox@8451
|
218 ("2" . "6") ("6" . "2"))
|
domcox@8451
|
219 (("1" . "en") ("2" . "ja")
|
domcox@8451
|
220 ("6" . "ch") ("9" . "ko")))
|
domcox@8451
|
221
|
domcox@8451
|
222 ;; Fresheye.com
|
domcox@8451
|
223 ("fresheye.com"
|
domcox@8451
|
224 "mt.fresheye.com"
|
domcox@8451
|
225 "/ft_result.cgi HTTP/1.1"
|
domcox@8451
|
226 "gen_text=%s&e=%o%t"
|
domcox@8451
|
227 utf-8
|
domcox@8451
|
228 "<TEXTAREA class=\"out-form\" name=\"gen_text2\" cols=\"25\" rows=\"15\">\\([^<]*\\)</TEXTAREA>"
|
domcox@8451
|
229 (("E" . "J") ("J" . "E"))
|
domcox@8451
|
230 (("E" . "en") ("J" . "ja")))
|
domcox@8451
|
231 ("fresheye.com"
|
domcox@8451
|
232 "mt.fresheye.com"
|
domcox@8451
|
233 "/ft_cjresult.cgi HTTP/1.1"
|
domcox@8451
|
234 "gen_text=%s&charset=gb2312&cjjc=%o%t"
|
domcox@8451
|
235 utf-8
|
domcox@8451
|
236 "<TEXTAREA class=\"out-form\" name=\"gen_text2\" cols=\"25\" rows=\"15\">\\([^<]*\\)</TEXTAREA>"
|
domcox@8451
|
237 (("c" . "j") ("j" . "c") ("e" . "c"))
|
domcox@8451
|
238 (("c" . "ch") ("j" . "ja") ("e" . "en")))
|
domcox@8451
|
239 ("fresheye.com"
|
domcox@8451
|
240 "mt.fresheye.com"
|
domcox@8451
|
241 "/ft_cjresult.cgi HTTP/1.1"
|
domcox@8451
|
242 "gen_text=%s&charset=big5&cjjc=%o%t"
|
domcox@8451
|
243 utf-8
|
domcox@8451
|
244 "<TEXTAREA class=\"out-form\" name=\"gen_text2\" cols=\"25\" rows=\"15\">\\([^<]*\\)</TEXTAREA>"
|
domcox@8451
|
245 (("c" . "j") ("j" . "c") ("e" . "c"))
|
domcox@8451
|
246 (("c" . "tw") ("j" . "ja") ("e" . "en")))
|
domcox@8451
|
247
|
domcox@8451
|
248 ;; Excite.co.jp
|
domcox@8451
|
249 ("excite.co.jp"
|
domcox@8451
|
250 "www.excite.co.jp"
|
domcox@8451
|
251 "/world/english/ HTTP/1.1"
|
domcox@8451
|
252 "wb_lp=%o%t&before=%s"
|
domcox@8451
|
253 utf-8
|
domcox@8451
|
254 "<textarea name=\"after\" id=\"after\">\\([^<]*\\)</textarea>"
|
domcox@8451
|
255 (("EN" . "JA") ("JA" . "EN"))
|
domcox@8451
|
256 (("EN" . "en") ("JA" . "ja")))
|
domcox@8451
|
257 ("excite.co.jp"
|
domcox@8451
|
258 "www.excite.co.jp"
|
domcox@8451
|
259 "/world/chinese/ HTTP/1.1"
|
domcox@8451
|
260 "wb_lp=%o%t&before=%s"
|
domcox@8451
|
261 utf-8
|
domcox@8451
|
262 "<textarea name=\"after\" id=\"after\">\\([^<]*\\)</textarea>"
|
domcox@8451
|
263 (("JA" . "CH") ("CH" . "JA"))
|
domcox@8451
|
264 (("JA" . "ja") ("CH" . "ch")))
|
domcox@8451
|
265 ("excite.co.jp"
|
domcox@8451
|
266 "www.excite.co.jp"
|
domcox@8451
|
267 "/world/chinese/ HTTP/1.1"
|
domcox@8451
|
268 "wb_lp=%o%t&big5=yes&before=%s"
|
domcox@8451
|
269 utf-8
|
domcox@8451
|
270 "<textarea name=\"after\" id=\"after\">\\([^<]*\\)</textarea>"
|
domcox@8451
|
271 (("JA" . "CH") ("CH" . "JA"))
|
domcox@8451
|
272 (("JA" . "ja") ("CH" . "tw")))
|
domcox@8451
|
273 ("excite.co.jp"
|
domcox@8451
|
274 "www.excite.co.jp"
|
domcox@8451
|
275 "/world/korean/ HTTP/1.1"
|
domcox@8451
|
276 "wb_lp=%o%t&before=%s"
|
domcox@8451
|
277 utf-8
|
domcox@8451
|
278 "<textarea name=\"after\" id=\"after\">\\([^<]*\\)</textarea>"
|
domcox@8451
|
279 (("JA" . "KO") ("KO" . "JA"))
|
domcox@8451
|
280 (("JA" . "ja") ("KO" . "ko")))
|
domcox@8451
|
281
|
domcox@8451
|
282 ;; Yahoo.co.jp
|
domcox@8451
|
283 ("yahoo.co.jp"
|
domcox@8451
|
284 "honyaku.yahoo.co.jp"
|
domcox@8451
|
285 "/transtext HTTP/1.1"
|
domcox@8451
|
286 "both=TH&text=%s&clearFlg=1&eid=CR-%o%t"
|
domcox@8451
|
287 utf-8
|
domcox@8451
|
288 "<textarea rows=12 cols=30 name=\"trn_text\" id=\"trn_textText\" class=\"smaller\">\\([^<]*\\)</textarea>"
|
domcox@8451
|
289 (("E" . "J") ("J" . "E")
|
domcox@8451
|
290 ("C" . "J") ("J" . "C-CN")
|
domcox@8451
|
291 ("K" . "J") ("J" . "K"))
|
domcox@8451
|
292 (("E" . "en") ("J" . "ja")
|
domcox@8451
|
293 ("C" . "ch") ("C-CN" . "ch")
|
domcox@8451
|
294 ("K" . "ko")))
|
domcox@8451
|
295
|
domcox@8451
|
296 ;; Ocn.ne.jp
|
domcox@8451
|
297 ("ocn.ne.jp"
|
domcox@8451
|
298 "cgi01.ocn.ne.jp"
|
domcox@8451
|
299 "/cgi-bin/translation/index.cgi HTTP/1.1"
|
domcox@8451
|
300 "langpair=%o%t&sourceText=%s"
|
domcox@8451
|
301 utf-8
|
domcox@8451
|
302 "<TEXTAREA NAME=\"responseText\" ROWS=\"5\" COLS=\"41\" WRAP=\"virtual\" CLASS=\"in2\">\\([^<]*\\)</TEXTAREA>"
|
domcox@8451
|
303 (("en" . "ja") ("ja" . "en")
|
domcox@8451
|
304 ("ja" . "ko") ("ko" . "ja")
|
domcox@8451
|
305 ("ja" . "zh") ("zh" . "ja"))
|
domcox@8451
|
306 (("zh" . "ch"))))
|
domcox@8451
|
307 "The alist where setting of the site which is used for text translation is
|
domcox@8451
|
308 described. To update site-data, evalute `text-translator-site-data-init`."
|
domcox@8451
|
309 :type '(repeat
|
domcox@8451
|
310 (list :tag "Web Site"
|
domcox@8451
|
311 (string :tag "Web site name and translation type")
|
domcox@8451
|
312 (string :tag "Host name")
|
domcox@8451
|
313 (string :tag "POST path and HTTP version")
|
domcox@8451
|
314 (string :tag "POST contents")
|
domcox@8451
|
315 (symbol :tag "Character code")
|
domcox@8451
|
316 (choice (string :tag "regexp") (symbol :tag "function"))
|
domcox@8451
|
317 (list :tag (concat "The correspondence of translation-able "
|
domcox@8451
|
318 "name (used by translation sites)"))
|
domcox@8451
|
319 (list :tag (concat "The correspondence of name that used by "
|
domcox@8451
|
320 "text-translator and name that used by "
|
domcox@8451
|
321 "translation sites"))))
|
domcox@8451
|
322 :group 'text-translator)
|
domcox@8451
|
323
|
domcox@8451
|
324 (defcustom text-translator-site-data-minimum-alist
|
domcox@8451
|
325 '(;; lou5.jp (Japanese, Lou)
|
domcox@8451
|
326 ("lou5.jp_*normal"
|
domcox@8451
|
327 "lou5.jp"
|
domcox@8451
|
328 "/ HTTP/1.1"
|
domcox@8451
|
329 "v=1&text=%s"
|
domcox@8451
|
330 utf-8
|
domcox@8451
|
331 (lambda ()
|
domcox@8451
|
332 (text-translator-extract-tag-exclusion-string
|
domcox@8451
|
333 "<p class=\"large align-left box\">\\(\\(.\\|\n\\)*?\\)</p>"
|
domcox@8451
|
334 t)))
|
domcox@8451
|
335 ;; lou5.jp (Japanese, Lou Blog)
|
domcox@8451
|
336 ("lou5.jp_*blog"
|
domcox@8451
|
337 "lou5.jp"
|
domcox@8451
|
338 "/ HTTP/1.1"
|
domcox@8451
|
339 "v=2&text=%s"
|
domcox@8451
|
340 utf-8
|
domcox@8451
|
341 "<p class=\"large align-left box\">\\(\\(.\\|\n\\)*?\\)</p>")
|
domcox@8451
|
342
|
domcox@8451
|
343 ;; tatoeba.org (Furigana, romaji)
|
domcox@8451
|
344 ("tatoeba.org_furigana"
|
domcox@8451
|
345 "tatoeba.org"
|
domcox@8451
|
346 "/eng/tools/romaji_furigana?query=%s&type=furigana HTTP/1.1"
|
domcox@8451
|
347 nil
|
domcox@8451
|
348 utf-8
|
domcox@8451
|
349 "class=\"furigana\">\\(\\(.\\|\n\\)*?\\)</div><form id=\"ToolRomajiFuriganaForm")
|
domcox@8451
|
350 ("tatoeba.org_romaji"
|
domcox@8451
|
351 "tatoeba.org"
|
domcox@8451
|
352 "/eng/tools/romaji_furigana?query=%s&type=romaji HTTP/1.1"
|
domcox@8451
|
353 nil
|
domcox@8451
|
354 utf-8
|
domcox@8451
|
355 "class=\"furigana\">\\(\\(.\\|\n\\)*?\\)</div><form id=\"ToolRomajiFuriganaForm")
|
domcox@8451
|
356
|
domcox@8451
|
357 ;; traduku.net (Esperanto, English)
|
domcox@8451
|
358 ("traduku.net_eoen"
|
domcox@8451
|
359 "traduku.net"
|
domcox@8451
|
360 "/cgi-bin/traduku HTTP/1.0"
|
domcox@8451
|
361 "eo_en&t=%s"
|
domcox@8451
|
362 utf-8
|
domcox@8451
|
363 " id=\"rezulto\">\\(\\(.\\|\n\\)*?\\)</div>")
|
domcox@8451
|
364 ("traduku.net_eneo"
|
domcox@8451
|
365 "traduku.net"
|
domcox@8451
|
366 "/cgi-bin/traduku HTTP/1.0"
|
domcox@8451
|
367 "en_eo_trukilo&t=%s"
|
domcox@8451
|
368 utf-8
|
domcox@8451
|
369 " id=\"rezulto\">\\(\\(.\\|\n\\)*?\\)</div>"))
|
domcox@8451
|
370
|
domcox@8451
|
371 "*The alist where setting of the site which is used for text translation is
|
domcox@8451
|
372 described. To update site-data, evalute `text-translator-site-data-init`."
|
domcox@8451
|
373 :type '(repeat
|
domcox@8451
|
374 (list :tag "Web Site"
|
domcox@8451
|
375 (string :tag "Web site name and translation type")
|
domcox@8451
|
376 (string :tag "Host name")
|
domcox@8451
|
377 (string :tag "POST path and HTTP version")
|
domcox@8451
|
378 (string :tag "POST contents")
|
domcox@8451
|
379 (symbol :tag "Character code")
|
domcox@8451
|
380 (choice (string :tag "regexp") (symbol :tag "function"))))
|
domcox@8451
|
381 :group 'text-translator)
|
domcox@8451
|
382
|
domcox@8451
|
383 ;; text-translator-site-data-template-alist
|
domcox@8451
|
384 ;; + text-translator-site-data-minimum-alist
|
domcox@8451
|
385 ;; = text-translator-site-data-alist
|
domcox@8451
|
386 (defvar text-translator-site-data-alist nil
|
domcox@8451
|
387 "The alist where setting of the site which is used for text translation is
|
domcox@8451
|
388 described.")
|
domcox@8451
|
389
|
domcox@8451
|
390 (defcustom text-translator-default-engine "google.com_enja"
|
domcox@8451
|
391 "*Translation engine used by default."
|
domcox@8451
|
392 :type (cons 'radio
|
domcox@8451
|
393 (mapcar
|
domcox@8451
|
394 (lambda (x)
|
domcox@8451
|
395 (list 'const (car x)))
|
domcox@8451
|
396 text-translator-site-data-alist))
|
domcox@8451
|
397 :group 'text-translator)
|
domcox@8451
|
398
|
domcox@8451
|
399 (defcustom text-translator-user-agent
|
domcox@8451
|
400 ;; "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4"
|
domcox@8451
|
401 "Mozilla/5.0 (Windows; U; Windows NT 5.0; ja; rv:1.9) Gecko/2008052906 Firefox/3.0"
|
domcox@8451
|
402 "*text-translator's User Agent. Default is Firefox."
|
domcox@8451
|
403 :type 'string
|
domcox@8451
|
404 :group 'text-translator)
|
domcox@8451
|
405
|
domcox@8451
|
406 (defcustom text-translator-mode-hook nil
|
domcox@8451
|
407 "*Hook run at the end of function `text-translator-mode'."
|
domcox@8451
|
408 :type 'hook
|
domcox@8451
|
409 :group 'text-translator)
|
domcox@8451
|
410
|
domcox@8451
|
411 (defcustom text-translator-auto-selection-func nil
|
domcox@8451
|
412 "*Value is function that select translation engine automatic.
|
domcox@8451
|
413 this value is function for `text-translator-translate-by-auto-selection'."
|
domcox@8451
|
414 :type 'symbol
|
domcox@8451
|
415 :group 'text-translator)
|
domcox@8451
|
416
|
domcox@8451
|
417 (defcustom text-translator-display-popup nil
|
domcox@8451
|
418 "*Non-nil means translated message is displayed by using popup-tip.
|
domcox@8451
|
419 To use this option, you have to require popup.el.
|
domcox@8451
|
420 popup.el URL: http://github.com/m2ym/auto-complete"
|
domcox@8451
|
421 :type 'symbol
|
domcox@8451
|
422 :group 'text-translator)
|
domcox@8451
|
423
|
domcox@8451
|
424 (defcustom text-translator-do-fill-region nil
|
domcox@8451
|
425 "*Default is nil. if value is non-nil, it deletes
|
domcox@8451
|
426 linefeed\\(and CR\\) from pre translation string(\"\\n\" -> \" \",
|
domcox@8451
|
427 \"\r\" -> \"\"). and processing to straighten faces with
|
domcox@8451
|
428 fill-paragraph after the translation. it is countermeasure
|
domcox@8451
|
429 against the translation engines that processes per line."
|
domcox@8451
|
430 :type 'symbol
|
domcox@8451
|
431 :group 'text-translator)
|
domcox@8451
|
432
|
domcox@8451
|
433 (defcustom text-translator-space-division-languages
|
domcox@8451
|
434 '("en" "es" "fr" "de" "it" "pt" "ru" "nl" "el" "no")
|
domcox@8451
|
435 "*List of language that word is delimited by blank."
|
domcox@8451
|
436 :type '(repeat (string :tag "language(2char)"))
|
domcox@8451
|
437 :group 'text-translator)
|
domcox@8451
|
438
|
domcox@8451
|
439 (defvar text-translator-last-string ""
|
domcox@8451
|
440 "The last time, character string which was thrown to the translation site.")
|
domcox@8451
|
441
|
domcox@8451
|
442 (defvar text-translator-engine-history nil
|
domcox@8451
|
443 "The history of translation engine which you used.")
|
domcox@8451
|
444
|
domcox@8451
|
445 (defvar text-translator-search-regexp-or-func nil)
|
domcox@8451
|
446
|
domcox@8451
|
447 (defvar text-translator-sitedata-hash nil)
|
domcox@8451
|
448
|
domcox@8451
|
449 (provide 'text-translator-vars)
|
domcox@8451
|
450 ;;; text-translator-vars.el ends here
|
domcox@8451
|
451
|
domcox@8451
|
452 ;; Local Variables:
|
domcox@8451
|
453 ;; Coding: utf-8
|
domcox@8451
|
454 ;; End:
|