Commit b1565011 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃 Committed by morgan
Browse files

Bug 1875313 - Use en-US as a fallback when spoof English is enabled in ICUUtils. r=timhuang,tjr

parent 28967952
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -47,8 +47,13 @@ void ICUUtils::LanguageTagIterForContent::GetNext(nsACString& aBCP47LangTag) {

  if (mCurrentFallbackIndex < 2) {
    mCurrentFallbackIndex = 2;
    // Else take the app's locale:

    // Else take the app's locale (or en-US, if spoof English applies):
    const bool spoofLocale = nsContentUtils::SpoofLocaleEnglish() &&
                             !mContent->OwnerDoc()->AllowsL10n();
    if (spoofLocale) {
      aBCP47LangTag.AssignLiteral("en-US");
      return;
    }
    nsAutoCString appLocale;
    LocaleService::GetInstance()->GetAppLocaleAsBCP47(aBCP47LangTag);
    return;