#include "base/command_line.h"
#include "base/compiler_specific.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
#include "base/i18n/file_util_icu.h"
#include "base/i18n/rtl.h"
#include "base/i18n/string_compare.h"
// does not support but available on Windows. We fall
// back to en-US in GetApplicationLocale so that it's a not critical,
// but we can do better.
- std::string::size_type hyphen_pos = locale.find('-');
- std::string lang(locale, 0, hyphen_pos);
- if (hyphen_pos != std::string::npos && hyphen_pos > 0) {
- std::string region(locale, hyphen_pos + 1);
+ const std::string lang(GetLanguage(locale));
+ if (lang.size() < locale.size()) {
+ std::string region(locale, lang.size() + 1);
std::string tmp_locale(lang);
// Map es-RR other than es-ES to es-419 (Chrome's Latin American
// Spanish locale).
return GetStringFUTF16(message_id, base::UTF8ToUTF16(base::Int64ToString(a)));
}
-// Specialization of operator() method for base::string16 version.
-template <>
-bool StringComparator<base::string16>::operator()(const base::string16& lhs,
- const base::string16& rhs) {
- // If we can not get collator instance for specified locale, just do simple
- // string compare.
- if (!collator_)
- return lhs < rhs;
- return base::i18n::CompareString16WithCollator(collator_, lhs, rhs) ==
- UCOL_LESS;
-};
-
base::string16 GetPluralStringFUTF16(const std::vector<int>& message_ids,
int number) {
scoped_ptr<icu::PluralFormat> format = BuildPluralFormat(message_ids);
return width;
}
+const char* const* GetAcceptLanguageListForTesting() {
+ return kAcceptLanguageList;
+}
+
+size_t GetAcceptLanguageListSizeForTesting() {
+ return arraysize(kAcceptLanguageList);
+}
+
} // namespace l10n_util