[webkit-changes] [WebKit/WebKit] ad7f91: Fix some i18n (localization) issues with Web Exten...

Timothy Hatcher noreply at github.com
Mon Nov 6 10:59:39 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ad7f91327f7f464c852905d7545926b5d352c97b
      https://github.com/WebKit/WebKit/commit/ad7f91327f7f464c852905d7545926b5d352c97b
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2023-11-06 (Mon, 06 Nov 2023)

  Changed paths:
    M Source/WebKit/Shared/Extensions/_WKWebExtensionLocalization.h
    M Source/WebKit/Shared/Extensions/_WKWebExtensionLocalization.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionURLSchemeHandlerCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtension.h
    M Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionContextProxyCocoa.mm
    M Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPILocalization.mm

  Log Message:
  -----------
  Fix some i18n (localization) issues with Web Extensions.
https://webkit.org/b/264211
rdar://problem/117948039

Reviewed by Brian Weinstein.

* Remove a FIXME for <https://webkit.org/b/261047> Handle multiple unique identifiers for localization.
  This wasn't needed after all since the @@extension_id message can't be used in the manifest.
* Supply the @@extension_id key with the extension's base URL host in the WebProcess.
* Suppress errors for file not found when attempting to discover localization message files.
* Don't attempt to read the same file twice if the default_locale matches the language or regional name.
* Don't support locale predefined messages when there is no default_locale.
* Bail early in more places if there are no localized strings.
* Removed some unused NSCoding key strings.
* Added more tests to cover these changes.

* Source/WebKit/Shared/Extensions/_WKWebExtensionLocalization.h:
* Source/WebKit/Shared/Extensions/_WKWebExtensionLocalization.mm:
(-[_WKWebExtensionLocalization initWithWebExtension:]):
(-[_WKWebExtensionLocalization initWithLocalizedDictionary:uniqueIdentifier:]): Added.
(-[_WKWebExtensionLocalization initWithRegionalLocalization:languageLocalization:defaultLocalization:withBestLocale:uniqueIdentifier:]):
(-[_WKWebExtensionLocalization localizedDictionaryForDictionary:]):
(-[_WKWebExtensionLocalization localizedStringForKey:withPlaceholders:]):
(-[_WKWebExtensionLocalization _localizedArrayForArray:]):
(-[_WKWebExtensionLocalization _localizationDictionaryForWebExtension:withLocale:]):
(-[_WKWebExtensionLocalization _predefinedMessages]):
(-[_WKWebExtensionLocalization _predefinedMessagesForLocale:]): Deleted.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm:
(WebKit::WebExtension::resourceStringForPath):
(WebKit::WebExtension::resourceDataForPath):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionURLSchemeHandlerCocoa.mm:
(WebKit::WebExtensionURLSchemeHandler::platformStartTask):
* Source/WebKit/UIProcess/Extensions/WebExtension.h:
* Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionContextProxyCocoa.mm:
(WebKit::WebExtensionContextProxy::getOrCreate):
(WebKit::WebExtensionContextProxy::parseLocalization):
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPILocalization.mm:
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list