From c3a58c95ce544380dd72d4219a3d877b80b4a6c1 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Thu, 3 Apr 2025 13:42:39 -0400 Subject: [PATCH] LibWebView: Add language settings to about:settings This implements a setting to change the languages provided to websites from `navigator.language(s)` and the `Accept-Language` header. Whereas the existing Qt settings dialog allows users to type their language of choice, this setting allows users to select from a predefined list of languages. They may choose any number of languages and their preferred order. This patch only implements the persisted settings and their UI. It does not integrate the choses languages into the WebContent process. --- Base/res/ladybird/about-pages/settings.html | 225 +++++++++++++++++- .../about-pages/settings/languages.js | 177 ++++++++++++++ Base/res/ladybird/ladybird.css | 4 + Libraries/LibWebView/Settings.cpp | 46 ++++ Libraries/LibWebView/Settings.h | 6 + Libraries/LibWebView/WebUI/SettingsUI.cpp | 11 + Libraries/LibWebView/WebUI/SettingsUI.h | 1 + UI/cmake/ResourceFiles.cmake | 9 + 8 files changed, 466 insertions(+), 13 deletions(-) create mode 100644 Base/res/ladybird/about-pages/settings/languages.js diff --git a/Base/res/ladybird/about-pages/settings.html b/Base/res/ladybird/about-pages/settings.html index e86390dbf87..4cb811836b7 100644 --- a/Base/res/ladybird/about-pages/settings.html +++ b/Base/res/ladybird/about-pages/settings.html @@ -215,6 +215,17 @@ opacity: 1; } + dialog .dialog-button:disabled { + opacity: 0.3; + } + + dialog .dialog-description { + margin-bottom: 10px; + + font-size: 14px; + opacity: 0.7; + } + dialog .dialog-list { outline: 1px solid var(--border-color); border-radius: 4px; @@ -256,7 +267,13 @@ gap: 10px; } - dialog .dialog-controls input { + dialog .dialog-controls button svg { + width: 16px; + height: 16px; + } + + dialog .dialog-controls input, + dialog .dialog-controls select { flex-grow: 1; } @@ -288,6 +305,13 @@ + +
+ +
+ Languages + +
@@ -349,6 +373,25 @@ + +
+

Languages

+ +
+
+

+ Choose languages for websites in order of preference +

+
+
+ + +
+
+
+

@@ -374,8 +417,16 @@
+ +