OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options/chromeos/cros_language_options_handler
.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler
.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // The list of configured locales might have entries not in | 242 // The list of configured locales might have entries not in |
243 // base_language_codes. If there are unsupported language variants, | 243 // base_language_codes. If there are unsupported language variants, |
244 // but they resolve to backup locale within base_language_codes, also | 244 // but they resolve to backup locale within base_language_codes, also |
245 // add them to the list. | 245 // add them to the list. |
246 for (std::map<std::string, int>::const_iterator iter = language_index.begin(); | 246 for (std::map<std::string, int>::const_iterator iter = language_index.begin(); |
247 iter != language_index.end(); | 247 iter != language_index.end(); |
248 ++iter) { | 248 ++iter) { |
249 const std::string& language_id = iter->first; | 249 const std::string& language_id = iter->first; |
250 const int language_idx = iter->second; | 250 const int language_idx = iter->second; |
251 | 251 |
252 const size_t dash_pos = language_id.find_first_of('-'); | 252 const std::string lang = l10n_util::GetLanguage(language_id); |
253 | 253 |
254 // Ignore non-specific codes. | 254 // Ignore non-specific codes. |
255 if (dash_pos == std::string::npos || dash_pos == 0) | 255 if (lang.empty() || lang == language_id) |
256 continue; | 256 continue; |
257 | 257 |
258 if (std::find(base_language_codes.begin(), | 258 if (std::find(base_language_codes.begin(), |
259 base_language_codes.end(), | 259 base_language_codes.end(), |
260 language_id) != base_language_codes.end()) { | 260 language_id) != base_language_codes.end()) { |
261 // Language is supported. No need to replace | 261 // Language is supported. No need to replace |
262 continue; | 262 continue; |
263 } | 263 } |
264 std::string resolved_locale; | 264 std::string resolved_locale; |
265 if (!l10n_util::CheckAndResolveLocale(language_id, &resolved_locale)) | 265 if (!l10n_util::CheckAndResolveLocale(language_id, &resolved_locale)) |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); | 568 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); |
569 const extensions::Extension* extension = | 569 const extensions::Extension* extension = |
570 enabled_extensions.GetByID(extension_id); | 570 enabled_extensions.GetByID(extension_id); |
571 if (extension) | 571 if (extension) |
572 entry->SetString("extensionName", extension->name()); | 572 entry->SetString("extensionName", extension->name()); |
573 } | 573 } |
574 } | 574 } |
575 | 575 |
576 } // namespace options | 576 } // namespace options |
577 } // namespace chromeos | 577 } // namespace chromeos |
OLD | NEW |