| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/views/options/language_combobox_model.h" | 5 #include "chrome/browser/views/options/language_combobox_model.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/metrics/user_metrics.h" | 10 #include "chrome/browser/metrics/user_metrics.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 LanguageComboboxModel::LanguageComboboxModel( | 28 LanguageComboboxModel::LanguageComboboxModel( |
| 29 Profile* profile, const std::vector<std::string>& locale_codes) | 29 Profile* profile, const std::vector<std::string>& locale_codes) |
| 30 : profile_(profile) { | 30 : profile_(profile) { |
| 31 InitNativeNames(locale_codes); | 31 InitNativeNames(locale_codes); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void LanguageComboboxModel::InitNativeNames( | 34 void LanguageComboboxModel::InitNativeNames( |
| 35 const std::vector<std::string>& locale_codes) { | 35 const std::vector<std::string>& locale_codes) { |
| 36 const std::string app_locale = WideToASCII( | 36 const std::string app_locale = g_browser_process->GetApplicationLocale(); |
| 37 g_browser_process->GetApplicationLocale()); | |
| 38 for (size_t i = 0; i < locale_codes.size(); ++i) { | 37 for (size_t i = 0; i < locale_codes.size(); ++i) { |
| 39 std::string locale_code_str = locale_codes[i]; | 38 std::string locale_code_str = locale_codes[i]; |
| 40 const char* locale_code = locale_codes[i].c_str(); | 39 const char* locale_code = locale_codes[i].c_str(); |
| 41 | 40 |
| 42 // Internally, we use the language code of zh-CN and zh-TW, but we want the | 41 // Internally, we use the language code of zh-CN and zh-TW, but we want the |
| 43 // display names to be Chinese (Simplified) and Chinese (Traditional). To | 42 // display names to be Chinese (Simplified) and Chinese (Traditional). To |
| 44 // do that, we use zh-hans and zh-hant when using ICU's | 43 // do that, we use zh-hans and zh-hant when using ICU's |
| 45 // uloc_getDisplayName. | 44 // uloc_getDisplayName. |
| 46 if (locale_code_str == "zh-CN") { | 45 if (locale_code_str == "zh-CN") { |
| 47 locale_code = "zh-hans"; | 46 locale_code = "zh-hans"; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 local_state = g_browser_process->local_state(); | 155 local_state = g_browser_process->local_state(); |
| 157 else | 156 else |
| 158 local_state = profile_->GetPrefs(); | 157 local_state = profile_->GetPrefs(); |
| 159 | 158 |
| 160 DCHECK(local_state); | 159 DCHECK(local_state); |
| 161 const std::string& current_locale = | 160 const std::string& current_locale = |
| 162 WideToASCII(local_state->GetString(prefs.c_str())); | 161 WideToASCII(local_state->GetString(prefs.c_str())); |
| 163 | 162 |
| 164 return GetIndexFromLocale(current_locale); | 163 return GetIndexFromLocale(current_locale); |
| 165 } | 164 } |
| OLD | NEW |