diff options
author | jcivelli@google.com <jcivelli@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-20 22:14:06 +0000 |
---|---|---|
committer | jcivelli@google.com <jcivelli@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-20 22:14:06 +0000 |
commit | d64b07bf98e4f27da4c22da6c615b75d4b2e16bc (patch) | |
tree | 345939445360af7d7ec3931ac8a839d5c08aa457 /chrome/browser/resources/translate.js | |
parent | 4bedba77d40df5fa5f1e00f5918123ee8711ca76 (diff) | |
download | chromium_src-d64b07bf98e4f27da4c22da6c615b75d4b2e16bc.zip chromium_src-d64b07bf98e4f27da4c22da6c615b75d4b2e16bc.tar.gz chromium_src-d64b07bf98e4f27da4c22da6c615b75d4b2e16bc.tar.bz2 |
Translate now supports translating pages for which we
don't know the original language: if the browser specifies undefined for the source language, we use the translate element in the page to detect the language.
BUG=40857
TEST=See bug.
Review URL: http://codereview.chromium.org/1508030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45094 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/translate.js')
-rw-r--r-- | chrome/browser/resources/translate.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/resources/translate.js b/chrome/browser/resources/translate.js index d761c11..24153db 100644 --- a/chrome/browser/resources/translate.js +++ b/chrome/browser/resources/translate.js @@ -67,6 +67,18 @@ cr.googleTranslate = (function() { }, /** + * The language the page translated was in. Is valid only after the page + * has been successfully translated and the original language specified to + * the translate function was 'auto'. Is empty otherwise. + * @type {boolean} + */ + get sourceLang() { + if (!libReady || !finished || error) + return ""; + return lib.getDetectedLanguage(); + }, + + /** * Translate the page contents. Note that the translation is asynchronous. * You need to regularly check the state of |finished| and |error| to know * if the translation finished or if there was an error. |