Chromium Code Reviews| Index: chrome/browser/speech/speech_recognition_request.cc |
| diff --git a/chrome/browser/speech/speech_recognition_request.cc b/chrome/browser/speech/speech_recognition_request.cc |
| index e17f69b1f09c2275cb31f54d1e97647c00602773..a4d01a2413efaf06ac674c808d175c987138681e 100644 |
| --- a/chrome/browser/speech/speech_recognition_request.cc |
| +++ b/chrome/browser/speech/speech_recognition_request.cc |
| @@ -12,6 +12,7 @@ |
| #include "chrome/common/net/url_request_context_getter.h" |
| #include "net/base/escape.h" |
| #include "net/base/load_flags.h" |
| +#include "net/url_request/url_request_context.h" |
| #include "net/url_request/url_request_status.h" |
| namespace { |
| @@ -128,8 +129,14 @@ bool SpeechRecognitionRequest::Send(const std::string& language, |
| if (!language.empty()) { |
| parts.push_back("lang=" + EscapeQueryParamValue(language, true)); |
| } else { |
| - std::string app_locale = l10n_util::GetApplicationLocale(""); |
| - parts.push_back("lang=" + EscapeQueryParamValue(app_locale, true)); |
| + // If no language is provided then we use the 1st from the accepted language list. |
|
Leandro GraciĆ” Gil
2010/11/15 16:57:07
Just noticed the line length. I'll fix this.
|
| + // If this list is empty then we default to "en-US". |
| + // Example of the contents of this list: "es,en-GB;q=0.8" , "" |
| + std::string list = url_context_->GetURLRequestContext()->accept_language(); |
| + size_t separator = list.find_first_of(",;"); |
| + std::string lang = list.substr(0, separator); |
| + if (lang.empty()) lang = "en-US"; |
| + parts.push_back("lang=" + EscapeQueryParamValue(lang, true)); |
| } |
| if (!grammar.empty()) |