summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorgwilson@google.com <gwilson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 15:48:22 +0000
committergwilson@google.com <gwilson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 15:48:22 +0000
commit080f7d558254ce49bd6acd70a4e1835dc6b1fc4a (patch)
tree690625b76cf3d081ffe4c4dd54ebb4e805961b1a /chrome/installer
parent5942dc32a1d9dc32aa208452ec72f8c076153f63 (diff)
downloadchromium_src-080f7d558254ce49bd6acd70a4e1835dc6b1fc4a.zip
chromium_src-080f7d558254ce49bd6acd70a4e1835dc6b1fc4a.tar.gz
chromium_src-080f7d558254ce49bd6acd70a4e1835dc6b1fc4a.tar.bz2
Modifies setup's fallback language order. If Omaha has a language specified in the registry, use that one first.
R=cpu,kuchhal BUG=39986 TEST=Install Chrome with a "lang" parameter specified to Omaha different than the system language. Then run setup.exe --show-eula and observe the EULA dialog is in one language, the one specified in the "lang" parameter. Review URL: http://codereview.chromium.org/1518019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44088 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/util/l10n_string_util.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/chrome/installer/util/l10n_string_util.cc b/chrome/installer/util/l10n_string_util.cc
index b28b459..6e9b726 100644
--- a/chrome/installer/util/l10n_string_util.cc
+++ b/chrome/installer/util/l10n_string_util.cc
@@ -14,18 +14,27 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
+#include "google_update_settings.h"
#include "installer_util_strings.h"
namespace {
-// Gets the language from the OS. If we're unable to get the system language,
-// defaults to en-us.
-std::wstring GetSystemLanguage() {
+// Gets the language from the OS, while taking a parameter to optionally pull
+// the language from Omaha's settings first.
+std::wstring GetSystemLanguage(const bool use_omaha_language) {
static std::wstring language;
if (!language.empty())
return language;
+
+ if (use_omaha_language) {
+ // First try to get the language from Omaha, if one is set already.
+ GoogleUpdateSettings::GetLanguage(&language);
+ if (!language.empty())
+ return language;
+ }
+
// We don't have ICU at this point, so we use win32 apis.
- LCID id = GetUserDefaultLangID();
+ LCID id = GetThreadLocale();
int length = GetLocaleInfo(id, LOCALE_SISO639LANGNAME, 0, 0);
if (0 == length) {
language = L"en-us";
@@ -73,6 +82,12 @@ std::wstring GetSystemLanguage() {
return language;
}
+// Gets the language from the OS. If we're unable to get the system language,
+// defaults to en-us.
+std::wstring GetSystemLanguage() {
+ return GetSystemLanguage(false);
+}
+
// This method returns the appropriate language offset given the language as a
// string. Note: This method is not thread safe because of how we create
// |offset_map|.
@@ -181,7 +196,7 @@ std::wstring GetLocalizedEulaResource() {
int len = ::GetModuleFileName(NULL, full_exe_path, MAX_PATH);
if (len == 0 || len == MAX_PATH)
return L"";
- std::wstring language = GetSystemLanguage();
+ std::wstring language = GetSystemLanguage(true);
const wchar_t* resource = L"IDR_OEMPG_EN.HTML";
static std::map<int, wchar_t*> html_map;