[tbb-commits] [Git][tpo/applications/mullvad-browser][mullvad-browser-115.7.0esr-13.0-1] 2 commits: Bug 1875306 - Localize numbers in the underflow and overflow error messages. r=emilio

richard (@richard) git at gitlab.torproject.org
Wed Feb 7 12:28:19 UTC 2024



richard pushed to branch mullvad-browser-115.7.0esr-13.0-1 at The Tor Project / Applications / Mullvad Browser


Commits:
6226fff7 by Pier Angelo Vendrame at 2024-02-07T12:28:05+00:00
Bug 1875306 - Localize numbers in the underflow and overflow error messages. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D198965
- - - - -
9e0fad12 by Pier Angelo Vendrame at 2024-02-07T12:28:05+00:00
Bug 1875313 - Use en-US as a fallback when spoof English is enabled in ICUUtils. r=timhuang,tjr

Differential Revision: https://phabricator.services.mozilla.com/D198967

- - - - -


2 changed files:

- dom/html/input/NumericInputTypes.cpp
- intl/unicharutil/util/ICUUtils.cpp


Changes:

=====================================
dom/html/input/NumericInputTypes.cpp
=====================================
@@ -52,11 +52,7 @@ nsresult NumericInputTypeBase::GetRangeOverflowMessage(nsAString& aMessage) {
   MOZ_ASSERT(!maximum.isNaN());
 
   nsAutoString maxStr;
-  char buf[32];
-  DebugOnly<bool> ok = maximum.toString(buf, ArrayLength(buf));
-  maxStr.AssignASCII(buf);
-  MOZ_ASSERT(ok, "buf not big enough");
-
+  ConvertNumberToString(maximum, maxStr);
   return nsContentUtils::FormatMaybeLocalizedString(
       aMessage, nsContentUtils::eDOM_PROPERTIES,
       "FormValidationNumberRangeOverflow", mInputElement->OwnerDoc(), maxStr);
@@ -67,11 +63,7 @@ nsresult NumericInputTypeBase::GetRangeUnderflowMessage(nsAString& aMessage) {
   MOZ_ASSERT(!minimum.isNaN());
 
   nsAutoString minStr;
-  char buf[32];
-  DebugOnly<bool> ok = minimum.toString(buf, ArrayLength(buf));
-  minStr.AssignASCII(buf);
-  MOZ_ASSERT(ok, "buf not big enough");
-
+  ConvertNumberToString(minimum, minStr);
   return nsContentUtils::FormatMaybeLocalizedString(
       aMessage, nsContentUtils::eDOM_PROPERTIES,
       "FormValidationNumberRangeUnderflow", mInputElement->OwnerDoc(), minStr);


=====================================
intl/unicharutil/util/ICUUtils.cpp
=====================================
@@ -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;



View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/e0af43495ec05b2f0b4a4f035ca4ca6935b54307...9e0fad12fab8f02154eb9cd83c2221faee09dcbf

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/e0af43495ec05b2f0b4a4f035ca4ca6935b54307...9e0fad12fab8f02154eb9cd83c2221faee09dcbf
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240207/d367ba7c/attachment-0001.htm>


More information about the tbb-commits mailing list