Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/l10n_util.cc

Issue 614773003: Revert of GetUILanguageList should correctly handle locale aliases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/login/l10n_util.h" 5 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 // Translate language codes, generated from input methods. 162 // Translate language codes, generated from input methods.
163 for (std::set<std::string>::const_iterator it = language_codes.begin(); 163 for (std::set<std::string>::const_iterator it = language_codes.begin();
164 it != language_codes.end(); ++it) { 164 it != language_codes.end(); ++it) {
165 // Exclude the language which is not in |base_langauge_codes| even it has 165 // Exclude the language which is not in |base_langauge_codes| even it has
166 // input methods. 166 // input methods.
167 if (std::find(base_language_codes.begin(), 167 if (std::find(base_language_codes.begin(),
168 base_language_codes.end(), 168 base_language_codes.end(),
169 *it) == base_language_codes.end()) { 169 *it) == base_language_codes.end()) {
170 // Try to translate language code and look up again. 170 continue;
171 std::string resolved_locale;
172
173 if (!l10n_util::CheckAndResolveLocale(*it, &resolved_locale))
174 continue;
175
176 if (std::find(base_language_codes.begin(),
177 base_language_codes.end(),
178 resolved_locale) == base_language_codes.end()) {
179 continue;
180 }
181 // Translated language was successfully found.
182 } 171 }
183 172
184 const base::string16 display_name = 173 const base::string16 display_name =
185 l10n_util::GetDisplayNameForLocale(*it, app_locale, true); 174 l10n_util::GetDisplayNameForLocale(*it, app_locale, true);
186 const base::string16 native_display_name = 175 const base::string16 native_display_name =
187 l10n_util::GetDisplayNameForLocale(*it, *it, true); 176 l10n_util::GetDisplayNameForLocale(*it, *it, true);
188 177
189 language_map[display_name] = 178 language_map[display_name] =
190 std::make_pair(*it, native_display_name); 179 std::make_pair(*it, native_display_name);
191 180
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { 492 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() {
504 const input_method::InputMethodDescriptor current_input_method = 493 const input_method::InputMethodDescriptor current_input_method =
505 input_method::InputMethodManager::Get() 494 input_method::InputMethodManager::Get()
506 ->GetActiveIMEState() 495 ->GetActiveIMEState()
507 ->GetCurrentInputMethod(); 496 ->GetCurrentInputMethod();
508 return CreateInputMethodsEntry(current_input_method, 497 return CreateInputMethodsEntry(current_input_method,
509 current_input_method.id()); 498 current_input_method.id());
510 } 499 }
511 500
512 } // namespace chromeos 501 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698