mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 13:57:32 +00:00
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:
parent
b686783787
commit
f00bcd8df5
@ -5,8 +5,8 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "OSPreferences.h"
|
#include "OSPreferences.h"
|
||||||
|
#include "mozilla/intl/Locale.h"
|
||||||
#include "mozilla/intl/LocaleService.h"
|
#include "mozilla/intl/LocaleService.h"
|
||||||
#include "mozilla/intl/MozLocale.h"
|
|
||||||
#include "mozilla/WindowsVersion.h"
|
#include "mozilla/WindowsVersion.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
|
|
||||||
@ -64,12 +64,14 @@ bool OSPreferences::ReadSystemLocales(nsTArray<nsCString>& aLocaleList) {
|
|||||||
// language code with no region subtag, but the
|
// language code with no region subtag, but the
|
||||||
// GlobalizationPreferences API may give us one (e.g. "ja").
|
// GlobalizationPreferences API may give us one (e.g. "ja").
|
||||||
// So if there's no hyphen in the string at this point, we use
|
// 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.
|
// go with it.
|
||||||
MozLocale locale(loc);
|
Locale locale;
|
||||||
if (locale.Maximize() && !locale.GetRegion().IsEmpty()) {
|
auto result = LocaleParser::tryParse(loc, locale);
|
||||||
|
if (result.isOk() && locale.addLikelySubtags() &&
|
||||||
|
locale.region().present()) {
|
||||||
loc.Append('-');
|
loc.Append('-');
|
||||||
loc.Append(locale.GetRegion());
|
loc.Append(locale.region().span());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aLocaleList.AppendElement(loc);
|
aLocaleList.AppendElement(loc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user