| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |