1 function babelfish (url
)
6 ["chinese-simp"] = 'zh',
7 ["chinese-simple"] = 'zh',
8 ["chinese-simplified"] = 'zh',
9 ["chinese-trad"] = 'zt',
10 ["chinese-traditional"] = 'zt',
12 ["nederlands"] = 'nl',
13 ["Nederlands"] = 'nl',
19 ["fran\231ais"] = 'fr',
25 ["portuguese"] = 'pt',
26 ["portugu\234s"] = 'pt',
30 ["espa\241ol"] = 'es',
33 _
,_
,from
,to
,rest
= string.find(url
, '^bb%s*([^%s]+)[%s]+([^%s]+)[%s]*(.*)')
35 if not rest
then return url
,nil end
37 from
= lang2code
[from
] or from
38 to
= lang2code
[to
] or to
40 lang_pair
= from
..'_'..to
42 if string.find(rest
, ':[^%s]') then
43 url
= "http://babelfish.altavista.com/babelfish/urltrurl"
44 .."?url="..escape(rest
)
47 url
= "http://babelfish.altavista.com/babelfish/tr"
48 .."?trtext="..escape(rest
)
55 table.insert(goto_url_hooks
, babelfish
)