google-translate 0.8.5 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,108 @@
1
+ # google_translate.rb
2
+
3
+ require 'open-uri'
4
+
5
+ require 'cgi'
6
+ require 'json'
7
+
8
+ class GoogleTranslate
9
+ GOOGLE_TRANSLATE_SERVICE_URL = "http://translate.google.com"
10
+
11
+ def self.Exception(*names)
12
+ cl = Module === self ? self : Object
13
+
14
+ names.each { |n| cl.const_set(n, Class.new(Exception)) }
15
+ end
16
+
17
+ Exception :MissingFromLanguage, :MissingToLanguage, :MissingTextLanguage, :TranslateServerIsDown,
18
+ :InvalidResponse, :MissingText, :MissingTestText
19
+
20
+ def translate(from, to, from_text, options={})
21
+ raise(MissingFromLanguage) if from.nil?
22
+ raise(MissingToLanguage) if to.nil?
23
+ raise(MissingTextLanguage) if from_text.nil?
24
+
25
+ begin
26
+ url = GOOGLE_TRANSLATE_SERVICE_URL + "/translate_a/t?client=t&text=#{from_text}&hl=#{from}&sl=#{from}&tl=#{to}&multires=1&prev=btn&ssel=0&tsel=4&uptl=#{to}&alttl=#{from}&sc=1"
27
+
28
+ open(URI.escape(url)) do |stream|
29
+ content = stream.read
30
+
31
+ s = content.split(',').collect { |s| s == '' ? "\"\"" : s }.join(",")
32
+
33
+ result = JSON.parse(s)
34
+
35
+ raise(TranslateServerIsDown) if (!result || result.empty?)
36
+
37
+ # raise(InvalidResponse, result["responseDetails"]) if response.code.to_i != 200 # success
38
+
39
+ r1 = result[0][0][0]
40
+ r2 = result[0][0][2]
41
+
42
+ [r1, r2]
43
+ end
44
+ rescue Exception => e
45
+ raise(TranslateServerIsDown)
46
+ end
47
+ end
48
+
49
+ def supported_languages
50
+ fetch_languages(GOOGLE_TRANSLATE_SERVICE_URL, [])
51
+ end
52
+
53
+ private
54
+
55
+ def fetch_languages(request, keys)
56
+ response = {}
57
+ open(URI.escape(request)) do |stream|
58
+ content = stream.read
59
+
60
+ from_languages = collect_languages content, 0, 'sl', 'gt-sl'
61
+ to_languages = collect_languages content, 1, 'tl', 'gt-tl'
62
+
63
+ response[:from_languages] = from_languages
64
+ response[:to_languages] = to_languages
65
+ end
66
+
67
+ response
68
+ end
69
+
70
+ def collect_languages buffer, index, tag_name, tag_id
71
+ languages = []
72
+
73
+ spaces = '\s?'
74
+ quote = '(\s|\'|")?'
75
+
76
+ id_part = "id#{spaces}=#{spaces}#{quote}#{tag_id}#{quote}"
77
+ name_part = "name#{spaces}=#{spaces}#{quote}#{tag_name}#{quote}"
78
+ class_part = "class#{spaces}=#{spaces}#{quote}(.*)?#{quote}"
79
+ tabindex_part = "tabindex#{spaces}=#{spaces}#{quote}0#{quote}"
80
+ phrase = "#{spaces}#{id_part}#{spaces}#{name_part}#{spaces}#{class_part}#{spaces}#{tabindex_part}#{spaces}"
81
+
82
+ re1 = buffer.split(%r{<select#{phrase}>(.*)?</select>}).select { |x| x =~ %r{<option} }
83
+
84
+ stopper = "</select>"
85
+
86
+ text = re1[index]
87
+
88
+ if index == 0
89
+ pos = text.index(stopper)
90
+ text = text[0..pos]
91
+ end
92
+
93
+ re2 = /<option(\s*)value="([a-z|A-Z|-]*)">([a-z|A-Z|\(|\)|\s]*)<\/option>/
94
+ matches = text.gsub(/selected/i, '').squeeze.scan(re2)
95
+
96
+ if matches.size == 0
97
+ re2 = /<option(\s*)value=([a-z|A-Z|-]*)>([a-z|A-Z|\(|\)|\s]*)<\/option>/
98
+ matches = text.gsub(/selected/i, '').squeeze.scan(re2)
99
+ end
100
+
101
+ matches.each do |m| languages << Language.new(m[2], m[1])
102
+ end
103
+
104
+ languages
105
+ end
106
+ end
107
+
108
+
@@ -0,0 +1,13 @@
1
+ class Language
2
+ attr_reader :name, :code
3
+
4
+ def initialize name, code
5
+ @name = name
6
+ @code = code
7
+ end
8
+
9
+ def to_s
10
+ "(" + code + ": " + name + ")"
11
+ end
12
+
13
+ end
@@ -0,0 +1,3 @@
1
+ class GoogleTranslate
2
+ VERSION = "0.8.6"
3
+ end
@@ -0,0 +1,39 @@
1
+ # translate_spec.rb
2
+
3
+ require File.dirname(__FILE__) + '/spec_helper'
4
+
5
+ require 'google_translate'
6
+
7
+ describe GoogleTranslate do
8
+
9
+ it "should raise an error if one of parameters is missing" do
10
+ expect { subject.translate(nil, :ru) }.to raise_error
11
+
12
+ expect { subject.translate(:en, nil) }.to raise_error
13
+
14
+ expect { subject.translate(:en, :ru, nil) }.to raise_error
15
+ end
16
+
17
+ it "should translate test string from one language to another" do
18
+ r = subject.translate(:en, :ru, "hello world!")
19
+ puts r
20
+ r.size.should be > 0
21
+ end
22
+
23
+ it "should translate test string from one language to another with autodetect" do
24
+ r = subject.translate(:auto, :ru, "hello world!")
25
+ puts r
26
+ r.size.should be > 0
27
+ end
28
+
29
+ it "should return unreliable flag if language is not recognized" do
30
+ subject.detect_language("azafretmkldt")['isReliable'].should be_false
31
+ end
32
+
33
+ it "should return list of supported languages" do
34
+ languages = subject.supported_languages
35
+
36
+ languages[:from_languages].size.should > 0
37
+ languages[:to_languages].size.should > 0
38
+ end
39
+ end
@@ -0,0 +1 @@
1
+ $: << File.expand_path('../lib', File.dirname(__FILE__))
data/test.html ADDED
@@ -0,0 +1,647 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
5
+ <meta name=keywords
6
+ content="translate, translations, translation, translator, machine translation, online translation">
7
+ <meta name=description
8
+ content="Google&#39;s free online language translation service instantly translates text and web pages. This translator supports: English, Afrikaans, Albanian, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bosnian, Bulgarian, Catalan, Cebuano, Chinese, Croatian, Czech, Danish, Dutch, Esperanto, Estonian, Filipino, Finnish, French, Galician, Georgian, German, Greek, Gujarati, Haitian Creole, Hebrew, Hindi, Hmong, Hungarian, Icelandic, Indonesian, Irish, Italian, Japanese, Javanese, Kannada, Khmer, Korean, Lao, Latin, Latvian, Lithuanian, Macedonian, Malay, Maltese, Marathi, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swahili, Swedish, Tamil, Telugu, Thai, Turkish, Ukrainian, Urdu, Vietnamese, Welsh, Yiddish">
9
+ <meta name=robots content=noodp>
10
+ <meta name=google content=notranslate>
11
+ <link rel="canonical" href="http://translate.google.com/">
12
+ <title>Google Translate</title>
13
+ <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml?hl=en"
14
+ title="Google Translate">
15
+ <script>JS_ERR_COUNT = 0;
16
+ JS_ERR_ARR = [];
17
+ function _gtErr(e, url, line) {
18
+ ++JS_ERR_COUNT;
19
+ var i = new Image();
20
+ var err = 'e=' + e.substr(0, 1500) + ',url=' + url.substr(0, 400) + ',line=' + line + ',count=' + JS_ERR_COUNT;
21
+ if (JS_ERR_COUNT < 10) {
22
+ JS_ERR_ARR.push(err);
23
+ }
24
+ i.src = '/gen204?jserr=' + encodeURIComponent(err);
25
+ i.onload = function () {
26
+ i.onload = null;
27
+ };
28
+ }
29
+ window.onerror = _gtErr;</script>
30
+ <script>(function () {
31
+ (function () {
32
+ function d(a) {
33
+ this.t = {};
34
+ this.tick = function (a, c, b) {
35
+ b = void 0 != b ? b : (new Date).getTime();
36
+ this.t[a] = [b, c]
37
+ };
38
+ this.tick("start", null, a)
39
+ }
40
+
41
+ var a = new d;
42
+ window.jstiming = {Timer: d, load: a};
43
+ if (window.performance && window.performance.timing) {
44
+ var a = window.performance.timing, c = window.jstiming.load, b = a.navigationStart, a = a.responseStart;
45
+ 0 < b && a >= b && (c.tick("_wtsrt", void 0, b), c.tick("wtsrt_", "_wtsrt", a), c.tick("tbsd_", "wtsrt_"))
46
+ }
47
+ try {
48
+ a = null, window.chrome && window.chrome.csi && (a = Math.floor(window.chrome.csi().pageT), c && 0 < b && (c.tick("_tbnd", void 0, window.chrome.csi().startE), c.tick("tbnd_", "_tbnd", b))), null == a && window.gtbExternal && (a = window.gtbExternal.pageT()), null == a && window.external && (a = window.external.pageT, c && 0 < b && (c.tick("_tbnd", void 0, window.external.startE), c.tick("tbnd_", "_tbnd", b))), a && (window.jstiming.pt = a)
49
+ } catch (e) {
50
+ }
51
+ })();
52
+ })() </script>
53
+ <link rel=stylesheet href="/translate/releases/twsfe_w_20130624_RC01/r/css/desktop_ltr.css">
54
+ <style>#clir {
55
+ margin-top: 18px;
56
+ text-align: left
57
+ }
58
+
59
+ #middle_body {
60
+ margin-left: 10em;
61
+ border-left: 1px solid #c9d7f1;
62
+ padding-left: 1.4em;
63
+ zoom: 1;
64
+ }</style>
65
+ <style>#gbar, #guser {
66
+ font-size: 13px;
67
+ padding-right: 1px;
68
+ padding-top: 1px !important;
69
+ }
70
+
71
+ #gbar {
72
+ padding-left: 1px;
73
+ height: 22px
74
+ }
75
+
76
+ #guser {
77
+ padding-bottom: 7px !important;
78
+ text-align: right
79
+ }
80
+
81
+ .gbh, .gbd {
82
+ border-top: 1px solid #c9d7f1;
83
+ font-size: 1px
84
+ }
85
+
86
+ .gbh {
87
+ height: 0;
88
+ position: absolute;
89
+ top: 24px;
90
+ width: 100%
91
+ }
92
+
93
+ @media all {
94
+ .gb1 {
95
+ height: 22;
96
+ margin-right: .5em;
97
+ vertical-align: top
98
+ }
99
+
100
+ #gbar {
101
+ float: left
102
+ }
103
+ }
104
+
105
+ a.gb1, a.gb4 {
106
+ text-decoration: underline !important
107
+ }
108
+
109
+ a.gb1, a.gb4 {
110
+ color: #00c !important
111
+ }
112
+
113
+ .gbi .gb4 {
114
+ color: #dd8e27 !important
115
+ }
116
+
117
+ .gbf .gb4 {
118
+ color: #900 !important
119
+ }</style>
120
+ <script>window.jstiming.load.tick('cl')</script>
121
+ <script></script>
122
+ </head>
123
+ <body dir=ltr onload="window.jstiming.load['tick']('ol');_csi('t','auto','en',document.text_form.text);"
124
+ class="e_md nj">
125
+ <div id=gbar>
126
+ <nobr><a class=gb1 href="http://www.google.com/webhp?hl=en&tab=Tw">Search</a> <a class=gb1
127
+ href="http://www.google.com/imghp?hl=en&tab=Ti">Images</a>
128
+ <a class=gb1 href="http://maps.google.com/maps?hl=en&tab=Tl">Maps</a> <a class=gb1
129
+ href="https://play.google.com/?hl=en&tab=T8">Play</a>
130
+ <a class=gb1 href="http://www.youtube.com/?tab=T1">YouTube</a> <a class=gb1
131
+ href="http://news.google.com/nwshp?hl=en&tab=Tn">News</a>
132
+ <a class=gb1 href="https://mail.google.com/mail/?tab=Tm">Gmail</a> <a class=gb1
133
+ href="https://drive.google.com/?tab=To">Drive</a>
134
+ <a class=gb1 style="text-decoration:none" href="http://www.google.com/intl/en/options/"><u>More</u> &raquo;</a>
135
+ </nobr>
136
+ </div>
137
+ <div id=guser width=100%>
138
+ <nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe><a
139
+ href="http://www.google.com/support/translate/" class=gb4>Help</a> | </span><a target=_top id=gb_70
140
+ href="https://accounts.google.com/ServiceLogin?hl=en&continue=http://translate.google.com/"
141
+ class=gb4>Sign in</a></nobr>
142
+ </div>
143
+ <div class=gbh style=left:0></div>
144
+ <div class=gbh style=right:0></div>
145
+ <script>document.body.className = document.body.className.replace('nj', '');</script>
146
+ <div id=gt-logo>
147
+ <div id=gt-logo-icon><a href="/?hl=en"><span height=40 alt="Google Translate" border=0
148
+ style="background:url(http://www.gstatic.com/translate/intl/en/logo2.png) 0 0 no-repeat;width:110px;height:40px;display:inline-block"></span></a>
149
+ </div>
150
+ </div>
151
+ <div id=gt-c class=g-section>
152
+ <div id=gt-bbar-c>
153
+ <div id=gt-bbar class=goog-inline-block></div>
154
+ </div>
155
+ <script>MSG_AD_QUERY = '';
156
+ MSG_ALPHA_DESC = 'This language is still in early stages of development and not yet up to the same quality standards as our other languages.';
157
+ MSG_ALT_PHRASE_TITLE = 'Click to edit and see alternate translations';
158
+ MSG_DISMISS = 'Dismiss';
159
+ MSG_DOWNLOAD_CHROME_BUTTON = '';
160
+ MSG_DOWNLOAD_CHROME_DESC = '';
161
+ MSG_CLEAR_TEXT = 'Clear text';
162
+ MSG_CLOSE = 'Close';
163
+ MSG_DRAG_PHRASE_TIP = '';
164
+ MSG_DRAG_PHRASE_TITLE = 'Drag with shift key to reorder.';
165
+ MSG_FILL_SUGGESTION = 'Contribute a better translation:';
166
+ MSG_LANGUAGE_CORRECTION = 'Translate from:';
167
+ MSG_LISTEN = 'Listen';
168
+ MSG_ORIGINAL_TEXT = 'Original text:';
169
+ MSG_READ_PHONETICALLY = 'Read phonetically';
170
+ MSG_SELECT_ALL = 'Select all';
171
+ MSG_SPELLING_CORRECTION = 'Did you mean:';
172
+ MSG_RELATED_SUGGESTION = 'See also:';
173
+ MSG_SUBMIT_SUGGESTION = 'Submit';
174
+ MSG_UNDO_EDITS = 'Undo edits';
175
+ MSG_USE_ALTERNATIVE = 'Use';
176
+ MSG_TTS_EN_AU = 'Australian';
177
+ MSG_TTS_EN_US = 'American';
178
+ MSG_TTS_EN_GB = 'British';
179
+ MSG_TTS_ES_ES = 'Iberian';
180
+ MSG_TTS_ES_419 = 'Latin American';
181
+ MSG_TTS_PT_BR = 'Brazilian';
182
+ MSG_TTS_PT_PT = 'European';
183
+ MSG_TTS_CMN = 'Mandarin';
184
+ MSG_TTS_YUE = 'Cantonese';
185
+ msg_disable_otf = 'Turn off instant translation';
186
+ msg_enable_otf = 'Turn on instant translation';
187
+ tr_in = 'Translating...';
188
+ MSG_EXAMPLE_OF_WORD = 'Example usage of \x22$word\x22:';
189
+ MSG_EXAMPLE_USAGE = 'Show example usage of words';
190
+ MSG_MT_FROM_GOOGLE = 'automatically translated by Google';
191
+ MSG_NO_EXAMPLE_FOUND = 'No examples found for \x22$word\x22';
192
+ MSG_CLICK_TO_TRANSLATE = 'Click to translate';
193
+ MSG_CHANGE_ITA = 'Select Input Tool';
194
+ MSG_IME_OFF = 'Turn off Input Method';
195
+ MSG_IME_ON = 'Turn on Input Method';
196
+ MSG_VK_OFF = 'Turn off Virtual Keyboard';
197
+ MSG_VK_ON = 'Turn on Virtual Keyboard';
198
+ MSG_ALL = 'All languages';
199
+ MSG_BACK_TO_ALL = 'Show all phrases';
200
+ MSG_DELETE = 'Delete';
201
+ MSG_DESTINATION = 'Destination Text';
202
+ MSG_EDIT = 'Edit';
203
+ MSG_HIDE_PB = 'Hide Phrasebook';
204
+ MSG_MY_PB = 'Phrasebook';
205
+ MSG_NEW = 'New!';
206
+ MSG_NEWEST = 'Recently added';
207
+ MSG_NP = 'Your Phrasebook is empty. Click the star under a translation to save it here.';
208
+ MSG_NPM = 'You don\x27t have any phrases for this language pair.';
209
+ MSG_OLDEST = 'Oldest';
210
+ MSG_PB_BUBBLE = 'Sign in and click the star to save this translation into your Phrasebook.';
211
+ MSG_PB_ERROR = 'Oops, something went wrong. Please try again later.';
212
+ MSG_PB_EXP = 'Export to Google Sheets';
213
+ MSG_PB_SR = 'Search result: %1$s matches.';
214
+ MSG_PB_TL = 'Sorry, the phrase you want to save is too long.';
215
+ MSG_PB_SIGNIN = 'Sign in to view your Phrasebook.';
216
+ MSG_SAVE = 'Save';
217
+ MSG_SAVED = 'Saved';
218
+ MSG_SAVE_PB = 'Sign in to save to Phrasebook';
219
+ MSG_SAVING = 'Saving...';
220
+ MSG_SHOW_PB = 'Show Phrasebook';
221
+ MSG_SIGN_IN = 'Sign in';
222
+ MSG_SORT_BY = 'Sort';
223
+ MSG_SOURCE = 'Original text';
224
+ MSG_TRANSLATE_FROM_LABEL = 'From:';
225
+ MSG_TRANSLATE_TO_LABEL = 'To:';
226
+ MSG_VIEW_PB = 'View my Phrasebook';
227
+ MSG_HELPFUL = 'Helpful';
228
+ MSG_NOT_HELPFUL = 'Not helpful';
229
+ MSG_OFFENSIVE = 'Offensive';
230
+ MSG_SIGN_IN_TO_RATE = 'Sign in to rate';
231
+ MSG_RATE_TRANSLATION = 'Rate translation';
232
+ MSG_RATED = 'Rated:';
233
+ DOWNLOAD_CHROME_URL = '';
234
+ ENCODING = 'ISO-8859-1';
235
+ DROP_LINK = 1;
236
+ MSG_IS_TRANSLATION_BETTER = 'Is this translation better than the original?';
237
+ MSG_SUBMIT_TRANSLATION = 'Yes, submit translation';
238
+ MSG_THANK_FOR_SUBMISSION = 'Thank you for your submission.';
239
+ WEBFONT = 1;
240
+ AD_TYPE = 0;
241
+ AD_TEST = 'off';
242
+ ALPHA_LANGUAGES = {'az': 1, 'bn': 1, 'ceb': 1, 'eu': 1, 'gu': 1, 'hmn': 1, 'ht': 1, 'hy': 1, 'jw': 1, 'ka': 1, 'km': 1, 'kn': 1, 'la': 1, 'lo': 1, 'mr': 1, 'ta': 1, 'te': 1, 'ur': 1};
243
+ DEFAULT_SOURCES = ['en', 'es', 'fr'];
244
+ DEFAULT_TARGETS = ['en', 'es', 'ar'];
245
+ DEFAULT_TTS_DIALECT_EN = 'en-US';
246
+ DEFAULT_TTS_DIALECT_ES = 'es-MX';
247
+ DEFAULT_TTS_DIALECT_PT = 'pt-BR';
248
+ DEFAULT_TTS_DIALECT_ZH = 'zh';
249
+ LOW_CONFIDENCE_THRESHOLD = -1;
250
+ MAX_ALTERNATIVES_ROUNDTRIP_RESULTS = 1;
251
+ WEB_TRANSLATION_PATH = '/translate';
252
+ SIGNED_IN = false;
253
+ USAGE = '';</script>
254
+ <div id=gt-form-c>
255
+ <form id=gt-form action="/" name=text_form method=post enctype="application/x-www-form-urlencoded">
256
+ <div id=gt-appbar>
257
+ <div id=gt-apb-c>
258
+ <div id=gt-apb-main><a id=gt-appname href="/">Translate</a>
259
+
260
+ <div id=gt-langs>
261
+ <div id=gt-lang-src><label for=gt-sl id=gt-lang-src-lbl class=nje>From:</label>
262
+ <select
263
+ id=gt-sl name=sl class="jfk-button jfk-button-standard nje" tabindex=0>
264
+ <option SELECTED value=auto>Detect language</option>
265
+ <option value=separator disabled>&#8212;</option>
266
+ <option value=af>Afrikaans</option>
267
+ <option value=sq>Albanian</option>
268
+ <option value=ar>Arabic</option>
269
+ <option value=hy>Armenian</option>
270
+ <option value=az>Azerbaijani</option>
271
+ <option value=eu>Basque</option>
272
+ <option value=be>Belarusian</option>
273
+ <option value=bn>Bengali</option>
274
+ <option value=bs>Bosnian</option>
275
+ <option value=bg>Bulgarian</option>
276
+ <option value=ca>Catalan</option>
277
+ <option value=ceb>Cebuano</option>
278
+ <option value=zh-CN>Chinese</option>
279
+ <option value=hr>Croatian</option>
280
+ <option value=cs>Czech</option>
281
+ <option value=da>Danish</option>
282
+ <option value=nl>Dutch</option>
283
+ <option value=en>English</option>
284
+ <option value=eo>Esperanto</option>
285
+ <option value=et>Estonian</option>
286
+ <option value=tl>Filipino</option>
287
+ <option value=fi>Finnish</option>
288
+ <option value=fr>French</option>
289
+ <option value=gl>Galician</option>
290
+ <option value=ka>Georgian</option>
291
+ <option value=de>German</option>
292
+ <option value=el>Greek</option>
293
+ <option value=gu>Gujarati</option>
294
+ <option value=ht>Haitian Creole</option>
295
+ <option value=iw>Hebrew</option>
296
+ <option value=hi>Hindi</option>
297
+ <option value=hmn>Hmong</option>
298
+ <option value=hu>Hungarian</option>
299
+ <option value=is>Icelandic</option>
300
+ <option value=id>Indonesian</option>
301
+ <option value=ga>Irish</option>
302
+ <option value=it>Italian</option>
303
+ <option value=ja>Japanese</option>
304
+ <option value=jw>Javanese</option>
305
+ <option value=kn>Kannada</option>
306
+ <option value=km>Khmer</option>
307
+ <option value=ko>Korean</option>
308
+ <option value=lo>Lao</option>
309
+ <option value=la>Latin</option>
310
+ <option value=lv>Latvian</option>
311
+ <option value=lt>Lithuanian</option>
312
+ <option value=mk>Macedonian</option>
313
+ <option value=ms>Malay</option>
314
+ <option value=mt>Maltese</option>
315
+ <option value=mr>Marathi</option>
316
+ <option value=no>Norwegian</option>
317
+ <option value=fa>Persian</option>
318
+ <option value=pl>Polish</option>
319
+ <option value=pt>Portuguese</option>
320
+ <option value=ro>Romanian</option>
321
+ <option value=ru>Russian</option>
322
+ <option value=sr>Serbian</option>
323
+ <option value=sk>Slovak</option>
324
+ <option value=sl>Slovenian</option>
325
+ <option value=es>Spanish</option>
326
+ <option value=sw>Swahili</option>
327
+ <option value=sv>Swedish</option>
328
+ <option value=ta>Tamil</option>
329
+ <option value=te>Telugu</option>
330
+ <option value=th>Thai</option>
331
+ <option value=tr>Turkish</option>
332
+ <option value=uk>Ukrainian</option>
333
+ <option value=ur>Urdu</option>
334
+ <option value=vi>Vietnamese</option>
335
+ <option value=cy>Welsh</option>
336
+ <option value=yi>Yiddish</option>
337
+ </select>
338
+
339
+ <div id="gt-sl-gms" class="goog-inline-block goog-flat-menu-button je">
340
+ <div class="goog-inline-block goog-flat-menu-button-caption">From: Detect language
341
+ </div>
342
+ <div class="goog-inline-block goog-flat-menu-button-dropdown"></div>
343
+ </div>
344
+ </div>
345
+ <div id=gt-lang-swap>
346
+ <div id=gt-swap title="Swap languages"
347
+ class="jfk-button-standard jfk-button-narrow jfk-button jfk-button-disabled trans-swap-button je">
348
+ <span class="jfk-button-img"></span></div>
349
+ </div>
350
+ <div id=gt-lang-tgt><label for=gt-tl id=gt-lang-tgt-lbl class=nje>To:</label><select
351
+ id=gt-tl name=tl class="jfk-button jfk-button-standard nje" tabindex=0>
352
+ <option value=af>Afrikaans</option>
353
+ <option value=sq>Albanian</option>
354
+ <option value=ar>Arabic</option>
355
+ <option value=hy>Armenian</option>
356
+ <option value=az>Azerbaijani</option>
357
+ <option value=eu>Basque</option>
358
+ <option value=be>Belarusian</option>
359
+ <option value=bn>Bengali</option>
360
+ <option value=bs>Bosnian</option>
361
+ <option value=bg>Bulgarian</option>
362
+ <option value=ca>Catalan</option>
363
+ <option value=ceb>Cebuano</option>
364
+ <option value=zh-CN>Chinese (Simplified)</option>
365
+ <option value=zh-TW>Chinese (Traditional)</option>
366
+ <option value=hr>Croatian</option>
367
+ <option value=cs>Czech</option>
368
+ <option value=da>Danish</option>
369
+ <option value=nl>Dutch</option>
370
+ <option SELECTED value=en>English</option>
371
+ <option value=eo>Esperanto</option>
372
+ <option value=et>Estonian</option>
373
+ <option value=tl>Filipino</option>
374
+ <option value=fi>Finnish</option>
375
+ <option value=fr>French</option>
376
+ <option value=gl>Galician</option>
377
+ <option value=ka>Georgian</option>
378
+ <option value=de>German</option>
379
+ <option value=el>Greek</option>
380
+ <option value=gu>Gujarati</option>
381
+ <option value=ht>Haitian Creole</option>
382
+ <option value=iw>Hebrew</option>
383
+ <option value=hi>Hindi</option>
384
+ <option value=hmn>Hmong</option>
385
+ <option value=hu>Hungarian</option>
386
+ <option value=is>Icelandic</option>
387
+ <option value=id>Indonesian</option>
388
+ <option value=ga>Irish</option>
389
+ <option value=it>Italian</option>
390
+ <option value=ja>Japanese</option>
391
+ <option value=jw>Javanese</option>
392
+ <option value=kn>Kannada</option>
393
+ <option value=km>Khmer</option>
394
+ <option value=ko>Korean</option>
395
+ <option value=lo>Lao</option>
396
+ <option value=la>Latin</option>
397
+ <option value=lv>Latvian</option>
398
+ <option value=lt>Lithuanian</option>
399
+ <option value=mk>Macedonian</option>
400
+ <option value=ms>Malay</option>
401
+ <option value=mt>Maltese</option>
402
+ <option value=mr>Marathi</option>
403
+ <option value=no>Norwegian</option>
404
+ <option value=fa>Persian</option>
405
+ <option value=pl>Polish</option>
406
+ <option value=pt>Portuguese</option>
407
+ <option value=ro>Romanian</option>
408
+ <option value=ru>Russian</option>
409
+ <option value=sr>Serbian</option>
410
+ <option value=sk>Slovak</option>
411
+ <option value=sl>Slovenian</option>
412
+ <option value=es>Spanish</option>
413
+ <option value=sw>Swahili</option>
414
+ <option value=sv>Swedish</option>
415
+ <option value=ta>Tamil</option>
416
+ <option value=te>Telugu</option>
417
+ <option value=th>Thai</option>
418
+ <option value=tr>Turkish</option>
419
+ <option value=uk>Ukrainian</option>
420
+ <option value=ur>Urdu</option>
421
+ <option value=vi>Vietnamese</option>
422
+ <option value=cy>Welsh</option>
423
+ <option value=yi>Yiddish</option>
424
+ </select>
425
+
426
+ <div id="gt-tl-gms" class="goog-inline-block goog-flat-menu-button je">
427
+ <div class="goog-inline-block goog-flat-menu-button-caption">To: English</div>
428
+ <div class="goog-inline-block goog-flat-menu-button-dropdown"></div>
429
+ </div>
430
+ </div>
431
+ <div id=gt-lang-submit><input type=submit id=gt-submit value="Translate" tabindex=0
432
+ class="jfk-button jfk-button-action"></div>
433
+ </div>
434
+ </div>
435
+ </div>
436
+ </div>
437
+ <div id=gt-text-all>
438
+ <div id=gt-main>
439
+ <div id=gt-text-c>
440
+ <div id=gt-text-top>
441
+ <div id=gt-src-c class=g-unit>
442
+ <div id=gt-src-p><input type=hidden name=js value=n id=js><input type=hidden name=prev
443
+ value="_t"
444
+ id=prev><input
445
+ type=hidden name=hl value="en" id=hl><input type=hidden name=ie
446
+ value="ISO-8859-1">
447
+
448
+ <div id=gt-src-lang-sugg class="gt-lang-sugg-message je">
449
+ <div class="goog-inline-block goog-toolbar-button">
450
+ <div class="goog-inline-block goog-toolbar-button-outer-box">
451
+ <div class="goog-inline-block goog-toolbar-button-inner-box">English
452
+ </div>
453
+ </div>
454
+ </div>
455
+ <div class="goog-inline-block goog-toolbar-button">
456
+ <div class="goog-inline-block goog-toolbar-button-outer-box">
457
+ <div class="goog-inline-block goog-toolbar-button-inner-box">Spanish
458
+ </div>
459
+ </div>
460
+ </div>
461
+ <div class="goog-inline-block goog-toolbar-button">
462
+ <div class="goog-inline-block goog-toolbar-button-outer-box">
463
+ <div class="goog-inline-block goog-toolbar-button-inner-box">French
464
+ </div>
465
+ </div>
466
+ </div>
467
+ </div>
468
+ <div id=gt-src-wrap><label for=source style="display:none">Translate text or
469
+ webpage</label>
470
+
471
+ <div style="width: 100%;"><textarea id=source name=text wrap=SOFT tabindex=0
472
+ dir="ltr" spellcheck="false"
473
+ autocapitalize="off" autocomplete="off"
474
+ autocorrect="off"></textarea></div>
475
+ <script>(function () {
476
+ var src = document.getElementById('source');
477
+ src.focus();
478
+ src.select();
479
+ src.style.boxSizing = src.style.WebkitBoxSizing = src.style.MozBoxSizing = src.style.MsBoxSizing = 'border-box';
480
+ })();</script>
481
+ <div id=gt-src-tools>
482
+ <div id=gt-src-tools-l></div>
483
+ <div id=gt-src-tools-r></div>
484
+ </div>
485
+ </div>
486
+ <div id=select_document>Type text or a website address or <a href="/?tr=f&hl=en">translate
487
+ a document.</a></div>
488
+ <div id=file_div class=file style="display:none">
489
+ <div id=select_text><a href="/?tr=t&hl=en">Cancel</a></div>
490
+ <input type=file name=file id=file size=40></div>
491
+ <div id=src-translit class=translit dir=ltr style="text-align:;display:none"></div>
492
+ <div id=spelling-correction style="display:none"></div>
493
+ <div id=gt-src-ex></div>
494
+ </div>
495
+ </div>
496
+ <div id=gt-res-c class=g-unit>
497
+ <div id=gt-res-p>
498
+ <div id=gt-res-data>
499
+ <div id=gt-tgt-lang-sugg class="gt-lang-sugg-message je">
500
+ <div class="goog-inline-block goog-toolbar-button goog-toolbar-button-checked">
501
+ <div class="goog-inline-block goog-toolbar-button-outer-box">
502
+ <div class="goog-inline-block goog-toolbar-button-inner-box">
503
+ English
504
+ </div>
505
+ </div>
506
+ </div>
507
+ <div class="goog-inline-block goog-toolbar-button">
508
+ <div class="goog-inline-block goog-toolbar-button-outer-box">
509
+ <div class="goog-inline-block goog-toolbar-button-inner-box">
510
+ Spanish
511
+ </div>
512
+ </div>
513
+ </div>
514
+ <div class="goog-inline-block goog-toolbar-button">
515
+ <div class="goog-inline-block goog-toolbar-button-outer-box">
516
+ <div class="goog-inline-block goog-toolbar-button-inner-box">
517
+ Arabic
518
+ </div>
519
+ </div>
520
+ </div>
521
+ </div>
522
+ <div id=gt-res-wrap>
523
+ <div id="gt-res-content" class=almost_half_cell>
524
+ <div dir="ltr" style="zoom:1">
525
+ <div id="tts_button" style="display:none" class="">
526
+ <object type="application/x-shockwave-flash"
527
+ data="//ssl.gstatic.com/translate/sound_player2.swf"
528
+ width="18" height="18" id="tts">
529
+ <param value="//ssl.gstatic.com/translate/sound_player2.swf"
530
+ name="movie"/>
531
+ <param value="sound_name_cb=_TTSSoundFile"
532
+ name="flashvars"/>
533
+ <param value="transparent" name="wmode"/>
534
+ <param value="always" name="allowScriptAccess"/>
535
+ </object>
536
+ </div>
537
+ <span id=result_box class="short_text"></span></div>
538
+ </div>
539
+ <div id=gt-res-tools>
540
+ <div id=gt-res-tools-l>
541
+ <div id=gt-pb-star></div>
542
+ <div id=gt-res-undo><a id=gt-undo style="display:none"></a></div>
543
+ </div>
544
+ <div id=gt-res-tools-r>
545
+ <div id="gt-alpha" class="goog-inline-block" style="display:none">
546
+ Alpha
547
+ </div>
548
+ </div>
549
+ </div>
550
+ </div>
551
+ <div id=res-translit class=translit dir=ltr style="text-align:"></div>
552
+ <div id=gt-res-ex></div>
553
+ <div id=gt-res-dict style="display:none"><h3>Dictionary</h3></div>
554
+ </div>
555
+ </div>
556
+ </div>
557
+ </div>
558
+ <div id=gt-question-promo><span class="jfk-butterBar jfk-butterBar-shown jfk-butterBar-info">Would you mind <a
559
+ target=_blank>answering some questions</a> to help improve translation quality?</span>
560
+ </div>
561
+ <div id=gt-ft>
562
+ <div id=gt-ft-mkt>
563
+ <div class=gt-ft-promos><span class=gt-ft-text>Google Translate for Business:</span><a
564
+ href="http://www.google.com/url?source=transpromo&rs=rsmf&q=http://translate.google.com/toolkit%3Fhl%3Den"><span
565
+ id="gt-ft-mkt-toolkit" class=gt-ft-mkt-icon></span>Translator Toolkit</a><a
566
+ href="http://www.google.com/url?source=transpromo&rs=rsmf&q=http://translate.google.com/manager/website/%3Fhl%3Den"><span
567
+ id="gt-ft-mkt-element" class=gt-ft-mkt-icon></span>Website Translator</a><a
568
+ href="http://www.google.com/url?source=transpromo&rs=rsmf&q=http://translate.google.com/globalmarketfinder/%3Flocale%3Den"><span
569
+ id="gt-ft-mkt-gmf" class=gt-ft-mkt-icon></span>Global Market Finder</a></div>
570
+ </div>
571
+ </div>
572
+ </div>
573
+ </div>
574
+ </div>
575
+ </form>
576
+ </div>
577
+ <script>{
578
+ window.jstiming.load.tick('rsw');
579
+ window.jstiming.load.tick('rsl');
580
+ window.jstiming.load.tick('rtl');
581
+ function _njClk(e) {
582
+ document.body.className += ' nj';
583
+ var i = new Image();
584
+ i.src = '/gen204?njclk=1';
585
+ i.onload = function () {
586
+ i.onload = null;
587
+ };
588
+ }
589
+
590
+ var slgms = document.getElementById('gt-sl-gms');
591
+ var tlgms = document.getElementById('gt-tl-gms');
592
+ slgms.onclick = tlgms.onclock = _njClk;
593
+ }</script>
594
+ <div id="gt-dd-filelink-help" style="display:none">Drag and drop file or link here to translate the document or web
595
+ page.
596
+ </div>
597
+ <div id="gt-dd-link-help" style="display:none">Drag and drop link here to translate the web page.</div>
598
+ <div id="gt-dd-file-error" style="display:none">We do not support the type of file you drop. Please try other file
599
+ types.
600
+ </div>
601
+ <div id="gt-dd-link-error" style="display:none">We do not support the type of link you drop. Please try link of
602
+ other types.
603
+ </div>
604
+ <div id=gt-ft-res><span id=ft-l><a id=gt-otf-switch href="/?hl=en&eotf=0">Turn off instant
605
+ translation</a></span><span id=ft-r><a
606
+ href="http://www.google.com/url?source=transpromo&rs=rssf&q=http://translate.google.com/about/intl/en_ALL/">About
607
+ Google Translate</a><a
608
+ href="http://www.google.com/url?source=transpromo&rs=rssf&q=http://www.google.com/mobile/translate/">Mobile</a><a
609
+ href="http://www.google.com/url?source=transpromo&rs=rssf&q=http://www.google.com/intl/en/privacy.html">Privacy</a><a
610
+ href="http://www.google.com/url?source=transpromo&rs=rssf&q=http://www.google.com/support/translate/">Help</a><a
611
+ href="javascript:void(0);" id="gt-feedback">Send feedback</a></span></div>
612
+ <script>MSG_GOOGLE_TRANSLATE = 'Google Translate';
613
+ common_translation_tooltip = 'Common translation';
614
+ detect_language = 'Detect language';
615
+ n_more_label = '+ %1$s more';
616
+ rare_translation_tooltip = 'Rare translation';
617
+ source_language_detected = '%1$s - detected';
618
+ uncommon_translation_tooltip = 'Uncommon translation';
619
+ url_hyperlink_tooltip = 'View translated webpage';
620
+ MSG_PUBLIC_EVAL_PATH = '';
621
+ MSG_PUBLIC_EVAL_PATH = '/question';
622
+ CLICKABLE_DICTIONARY = 1;
623
+ REORDERING = 1;
624
+ EXPERIMENT_IDS = [];
625
+ FILE_TRANSLATION_PATH = 'http://translate.googleusercontent.com/translate_f';
626
+ PUBLIC_EVAL_LANGUAGE_PAIRS = {};
627
+ PUBLIC_EVAL_LANGUAGE_PAIRS = {"en/mi": true, "mi/en": true};
628
+ TEXT_TRANSLATION_PATH = '/';
629
+ TR_ASYNC_JS_PATH = '/translate/releases/twsfe_w_20130624_RC01/r/js/desktop_module_async.js';
630
+ TR_LAZY_JS_PATH = '/translate/releases/twsfe_w_20130624_RC01/r/js/desktop_module_lazy.js';
631
+ TTS_TEXT_SIZE_LIMIT = 100;
632
+ TRANSLATED_TEXT = '';
633
+ INPUT_TOOL_PATH = '//www.google.com';
634
+ var ctr, h;
635
+ tld = '.com';
636
+ FEATURE_STICKINESS = [
637
+ [, , , 0, "auto", "en"],
638
+ 1
639
+ ];</script>
640
+ <script src="/translate/releases/twsfe_w_20130624_RC01/r/js/desktop_module_main.js"></script>
641
+ <script>window.jstiming.load.tick('br');
642
+ Init();
643
+ window.jstiming.load.tick('prt');</script>
644
+ <script>TR_ASYNC_JS_PATH && LoadJsModule(TR_ASYNC_JS_PATH);</script>
645
+ </div>
646
+ </body>
647
+ </html>