Commit 2aee9abe authored by Brian Stell's avatar Brian Stell Committed by Commit Bot

Simplify bcp47 conversion of locale without script tag.

Change-Id: I741d53f3e132a4770fa738b7e902c1f24eafd594
Reviewed-on: https://chromium-review.googlesource.com/1107237
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: 's avatarJungshik Shin <jshin@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53895}
parent 3e5eff73
......@@ -1143,14 +1143,7 @@ std::set<std::string> IntlUtil::GetAvailableLocales(const IcuService& service) {
std::string shortened_locale;
if (IntlUtil::RemoveLocaleScriptTag(icu_name, &shortened_locale)) {
error = U_ZERO_ERROR;
char bcp47_result[ULOC_FULLNAME_CAPACITY];
uloc_toLanguageTag(shortened_locale.c_str(), bcp47_result,
ULOC_FULLNAME_CAPACITY, true, &error);
if (U_FAILURE(error) || error == U_STRING_NOT_TERMINATED_WARNING) {
// This shouldn't happen, but lets not break the user.
continue;
}
std::replace(shortened_locale.begin(), shortened_locale.end(), '_', '-');
locales.insert(shortened_locale);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment