| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This code is used in conjunction with the Google Translate Element script. | 5 // This code is used in conjunction with the Google Translate Element script. |
| 6 // It is executed in an isolated world of a page to translate it from one | 6 // It is executed in an isolated world of a page to translate it from one |
| 7 // language to another. | 7 // language to another. |
| 8 // It should be included in the page before the Translate Element script. | 8 // It should be included in the page before the Translate Element script. |
| 9 | 9 |
| 10 var cr = cr || {}; | 10 var cr = cr || {}; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 * has been successfully translated and the original language specified to | 172 * has been successfully translated and the original language specified to |
| 173 * the translate function was 'auto'. Is empty otherwise. | 173 * the translate function was 'auto'. Is empty otherwise. |
| 174 * Some versions of Element library don't provide |getDetectedLanguage| | 174 * Some versions of Element library don't provide |getDetectedLanguage| |
| 175 * function. In that case, this function returns 'und'. | 175 * function. In that case, this function returns 'und'. |
| 176 * @type {boolean} | 176 * @type {boolean} |
| 177 */ | 177 */ |
| 178 get sourceLang() { | 178 get sourceLang() { |
| 179 if (!libReady || !finished || errorCode != ERROR['NONE']) | 179 if (!libReady || !finished || errorCode != ERROR['NONE']) |
| 180 return ''; | 180 return ''; |
| 181 if (!lib.getDetectedLanguage) | 181 if (!lib.getDetectedLanguage) |
| 182 return 'und'; // defined as chrome::kUnknownLanguageCode in C++ world. | 182 return 'und'; // Defined as translate::kUnknownLanguageCode in C++. |
| 183 return lib.getDetectedLanguage(); | 183 return lib.getDetectedLanguage(); |
| 184 }, | 184 }, |
| 185 | 185 |
| 186 /** | 186 /** |
| 187 * Time in msec from this script being injected to all server side scripts | 187 * Time in msec from this script being injected to all server side scripts |
| 188 * being loaded. | 188 * being loaded. |
| 189 * @type {number} | 189 * @type {number} |
| 190 */ | 190 */ |
| 191 get loadTime() { | 191 get loadTime() { |
| 192 if (loadedTime == 0) | 192 if (loadedTime == 0) |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 if (this.status != 200) { | 305 if (this.status != 200) { |
| 306 errorCode = ERROR['SCRIPT_LOAD_ERROR']; | 306 errorCode = ERROR['SCRIPT_LOAD_ERROR']; |
| 307 return; | 307 return; |
| 308 } | 308 } |
| 309 eval(this.responseText); | 309 eval(this.responseText); |
| 310 } | 310 } |
| 311 xhr.send(); | 311 xhr.send(); |
| 312 } | 312 } |
| 313 }; | 313 }; |
| 314 })(); | 314 })(); |
| OLD | NEW |