summaryrefslogtreecommitdiffstats
path: root/chrome/browser/translate/translate_manager.h
diff options
context:
space:
mode:
authordfilimon@google.com <dfilimon@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-12 13:06:31 +0000
committerdfilimon@google.com <dfilimon@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-12 13:06:31 +0000
commit3f0fe5d075a185562ebaa540f062696d6e53e2a5 (patch)
tree3810706bce050da31ae088c3fa152bba81fde570 /chrome/browser/translate/translate_manager.h
parent0d80b8cb59db7ed226f7b5ff75afd268df9f46fe (diff)
downloadchromium_src-3f0fe5d075a185562ebaa540f062696d6e53e2a5.zip
chromium_src-3f0fe5d075a185562ebaa540f062696d6e53e2a5.tar.gz
chromium_src-3f0fe5d075a185562ebaa540f062696d6e53e2a5.tar.bz2
GetTargetLanguage() returns the UI language if it's supported by the
translation service or the first supported language in the accepted languages list. If there is no such language, returns "". BUG=37328 TEST=1. browser_tests: TranslateManagerTest.TranslateAcceptLanguage and TranslateManagerTest.UnsupportedUILanguag 2. a. Start Chrome in the UI language that's unsupported by the translation service (like Amharic). On Windows, "chrome --lang=am". On Linux, 'LANGUAGE=am chrome' with Amharic locale installed. b. add a language supported by the translation service to the Accept-Languages list (e.g Italian and Spanish). c. When navigating to a page in a third language (e.g. French), it should offer to translate to the first supported language in the Accept-Language list (Italian in the scenario). Contributed by dfilimon@google.com Review URL: http://codereview.chromium.org/7327008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/translate/translate_manager.h')
-rw-r--r--chrome/browser/translate/translate_manager.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/chrome/browser/translate/translate_manager.h b/chrome/browser/translate/translate_manager.h
index ab710f2..2537d8e 100644
--- a/chrome/browser/translate/translate_manager.h
+++ b/chrome/browser/translate/translate_manager.h
@@ -168,10 +168,13 @@ class TranslateManager : public NotificationObserver,
// translate infobar is showing, it just replaces it with the new one.
void ShowInfoBar(TabContents* tab, TranslateInfoBarDelegate* infobar);
- // Returns the language to translate to, which is the language the UI is
- // configured in. Returns an empty string if that language is not supported
- // by the translation service.
- static std::string GetTargetLanguage();
+ // Returns the language to translate to. The language returned is the
+ // first language found in the following list that is supported by the
+ // translation service:
+ // the UI language
+ // the accept-language list
+ // If no language is found then an empty string is returned.
+ static std::string GetTargetLanguage(PrefService* prefs);
// Returns the translate info bar showing in |tab| or NULL if none is showing.
static TranslateInfoBarDelegate* GetTranslateInfoBarDelegate(