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

Side by Side Diff: app/l10n_util.cc

Issue 3750001: base: Move SplitString functions into the base namespace and update the callers. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: brett review, reverted changes in o3d due to it's using an old base revision Created 10 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 | app/text_elider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/l10n_util.h" 5 #include "app/l10n_util.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
8 8
9 #include "app/app_paths.h" 9 #include "app/app_paths.h"
10 #include "app/l10n_util_collator.h" 10 #include "app/l10n_util_collator.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // Split and normalize the language list specified by LANGUAGE environment. 332 // Split and normalize the language list specified by LANGUAGE environment.
333 // LANGUAGE environment specifies a priority list of user prefered locales for 333 // LANGUAGE environment specifies a priority list of user prefered locales for
334 // application UI messages. Locales are separated by ':' character. The format 334 // application UI messages. Locales are separated by ':' character. The format
335 // of a locale is: language[_territory[.codeset]][@modifier] 335 // of a locale is: language[_territory[.codeset]][@modifier]
336 // 336 //
337 // This function splits the language list and normalizes each locale into 337 // This function splits the language list and normalizes each locale into
338 // language[-territory] format, eg. fr, zh-CN, etc. 338 // language[-territory] format, eg. fr, zh-CN, etc.
339 void SplitAndNormalizeLanguageList(const std::string& env_language, 339 void SplitAndNormalizeLanguageList(const std::string& env_language,
340 std::vector<std::string>* result) { 340 std::vector<std::string>* result) {
341 std::vector<std::string> langs; 341 std::vector<std::string> langs;
342 SplitString(env_language, ':', &langs); 342 base::SplitString(env_language, ':', &langs);
343 std::vector<std::string>::iterator i = langs.begin(); 343 std::vector<std::string>::iterator i = langs.begin();
344 for (; i != langs.end(); ++i) { 344 for (; i != langs.end(); ++i) {
345 size_t end_pos = i->find_first_of(".@"); 345 size_t end_pos = i->find_first_of(".@");
346 // Erase encoding and modifier part. 346 // Erase encoding and modifier part.
347 if (end_pos != std::string::npos) 347 if (end_pos != std::string::npos)
348 i->erase(end_pos); 348 i->erase(end_pos);
349 349
350 if (!i->empty()) { 350 if (!i->empty()) {
351 std::string locale; 351 std::string locale;
352 size_t sep = i->find_first_of("_-"); 352 size_t sep = i->find_first_of("_-");
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 for (size_t i = 0; i < arraysize(kAcceptLanguageList); ++i) { 900 for (size_t i = 0; i < arraysize(kAcceptLanguageList); ++i) {
901 if (!IsLocaleNameTranslated(kAcceptLanguageList[i], display_locale)) 901 if (!IsLocaleNameTranslated(kAcceptLanguageList[i], display_locale))
902 // TODO(jungshik) : Put them at the of the list with language codes 902 // TODO(jungshik) : Put them at the of the list with language codes
903 // enclosed by brackets instead of skipping. 903 // enclosed by brackets instead of skipping.
904 continue; 904 continue;
905 locale_codes->push_back(kAcceptLanguageList[i]); 905 locale_codes->push_back(kAcceptLanguageList[i]);
906 } 906 }
907 } 907 }
908 908
909 } // namespace l10n_util 909 } // namespace l10n_util
OLDNEW
« no previous file with comments | « no previous file | app/text_elider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698