[webkit-changes] [WebKit/WebKit] 2ec032: Properly support es-419 in Web Extensions.

Timothy Hatcher noreply at github.com
Tue Oct 29 20:09:23 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2ec032a3571230b5921e6403f84b3a4828980838
      https://github.com/WebKit/WebKit/commit/2ec032a3571230b5921e6403f84b3a4828980838
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2024-10-29 (Tue, 29 Oct 2024)

  Changed paths:
    M Source/WTF/wtf/Language.cpp
    M Source/WTF/wtf/Language.h
    M Source/WebKit/Shared/Extensions/WebExtensionUtilities.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPILocalization.mm

  Log Message:
  -----------
  Properly support es-419 in Web Extensions.
https://webkit.org/b/282262
rdar://problem/138857112

Reviewed by Brian Weinstein.

Apply some feedback to `parseLocale` to properly handle locales with numeric region
codes and better handling of components. And adopt `regionCode` instead of `countryCode`
to match the BCP47 spec.

Add tests to verify Mexico and Spain pick the right locales.

* Source/WTF/wtf/Language.cpp:
(WTF::parseLocale): Improve parsing to handle 3 digit region codes.
(WTF::indexOfBestMatchingLanguageInList): Use regionCode.
* Source/WTF/wtf/Language.h:
* Source/WebKit/Shared/Extensions/WebExtensionUtilities.mm:
(WebKit::toWebAPI): Include scriptCode.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPILocalization.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPILocalization, i18nSpanishLatinAmerica)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPILocalization, i18nSpanishMexico)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPILocalization, i18nSpanishSpain)): Added.

Canonical link: https://commits.webkit.org/285875@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list