[webkit-changes] [WebKit/WebKit] f1892e: REGRESSION: Web Extensions do not pick zh locale w...

Timothy Hatcher noreply at github.com
Wed Jan 15 15:58:33 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f1892e20fbb3e547cda226631b3cafe6bcc2e471
      https://github.com/WebKit/WebKit/commit/f1892e20fbb3e547cda226631b3cafe6bcc2e471
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2025-01-15 (Wed, 15 Jan 2025)

  Changed paths:
    M Source/WebKit/UIProcess/Extensions/WebExtension.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPILocalization.mm

  Log Message:
  -----------
  REGRESSION: Web Extensions do not pick zh locale when zh-Hant is preferred.
https://webkit.org/b/286024
rdar://142602243

Reviewed by Brian Weinstein.

On Apple platforms, the best match search uses Foundation, which skips "zh" when the preferred locale is "zh-Hant",
likely assuming "zh" refers to simplified Chinese. However, web extensions expect the base language to be selected
if it is supported, regardless of specific variants.

Fix this by adding a special-case for base language fallback before using the default locale.

* Source/WebKit/UIProcess/Extensions/WebExtension.cpp:
(WebKit::WebExtension::bestMatchLocale): Added base language fallback.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPILocalization.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPILocalization, i18nChineseTraditionalFallback)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPILocalization, i18nChineseSimplifiedFallback)): Added.

Canonical link: https://commits.webkit.org/288974@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