Bug 1736017 - Replace MozLocale with Locale in OSPreferences_win.cpp; r=platform-i18n-reviewers,gregtatum

Differential Revision: https://phabricator.services.mozilla.com/D129212
This commit is contained in:
Dan Minor 2021-10-27 20:35:57 +00:00
parent b686783787
commit f00bcd8df5

View File

@ -5,8 +5,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "OSPreferences.h"
#include "mozilla/intl/Locale.h"
#include "mozilla/intl/LocaleService.h"
#include "mozilla/intl/MozLocale.h"
#include "mozilla/WindowsVersion.h"
#include "nsReadableUtils.h"
@ -64,12 +64,14 @@ bool OSPreferences::ReadSystemLocales(nsTArray<nsCString>& aLocaleList) {
// language code with no region subtag, but the
// GlobalizationPreferences API may give us one (e.g. "ja").
// So if there's no hyphen in the string at this point, we use
// MozLocale::Maximize to get a suitable region code to
// addLikelySubtags to get a suitable region code to
// go with it.
MozLocale locale(loc);
if (locale.Maximize() && !locale.GetRegion().IsEmpty()) {
Locale locale;
auto result = LocaleParser::tryParse(loc, locale);
if (result.isOk() && locale.addLikelySubtags() &&
locale.region().present()) {
loc.Append('-');
loc.Append(locale.GetRegion());
loc.Append(locale.region().span());
}
}
aLocaleList.AppendElement(loc);