1 """MoinMoin action for GoogleTranslate by yong27, 2006-04-19
2 """
3 from MoinMoin.Page import Page
4
5 template = """
6 <form action="http://www.google.com/translate">
7 <input type=hidden name=u value="%s">
8
9 <font size=-1>from</font>
10 <select name=langpair>
11 <option value="en|de">English to German</option>
12 <option value="en|es">English to Spanish</option>
13 <option value="en|fr">English to French</option>
14 <option value="en|it">English to Italian</option>
15 <option value="en|pt">English to Portuguese</option>
16 <option value="en|ja">English to Japanese BETA</option>
17 <option value="en|ko">English to Korean BETA</option>
18 <option value="en|zh-CN">English to Chinese (Simplified) BETA</option>
19 <option value="de|en" selected>German to English</option>
20 <option value="de|fr">German to French</option>
21 <option value="es|en">Spanish to English</option>
22 <option value="fr|en">French to English</option>
23 <option value="fr|de">French to German</option>
24 <option value="it|en">Italian to English</option>
25 <option value="pt|en">Portuguese to English</option>
26 <option value="ja|en">Japanese to English BETA</option>
27 <option value="ko|en">Korean to English BETA</option>
28 <option value="zh-CN|en">Chinese (Simplified) to English BETA</option>
29 </select>
30 <input type=hidden name=hl value=en>
31 <input type=hidden name=ie value="UTF8">
32 <input type=submit value="Translate"></form>
33 """
34
35 def execute(pagename, request):
36 page = Page(request, pagename)
37 actname = __name__.split('.')[-1]
38
39 if actname in request.cfg.actions_excluded \
40 or not request.user.may.write(pagename) \
41 or not request.user.may.delete(pagename):
42 return page.send_page(request,
43 msg=_('You are not allowed to translate this page'))
44
45 url=request.url.split('?')[0]
46
47 return page.send_page(request,
48 msg=template%url)
GoogleTranslate.py (last edited 2011-08-03 11:00:57 by localhost)