mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
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.
This commit is contained in:
parent
26ec01068f
commit
f242920cc9
Notes:
github-actions[bot]
2025-04-04 08:17:38 +00:00
Author: https://github.com/trflynn89
Commit: f242920cc9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4215
Reviewed-by: https://github.com/gmta ✅
8 changed files with 466 additions and 13 deletions
|
@ -24,6 +24,9 @@ void SettingsUI::register_interfaces()
|
|||
register_interface("setNewTabPageURL"sv, [this](auto const& data) {
|
||||
set_new_tab_page_url(data);
|
||||
});
|
||||
register_interface("setLanguages"sv, [this](auto const& data) {
|
||||
set_languages(data);
|
||||
});
|
||||
|
||||
register_interface("loadAvailableEngines"sv, [this](auto const&) {
|
||||
load_available_engines();
|
||||
|
@ -80,6 +83,14 @@ void SettingsUI::set_new_tab_page_url(JsonValue const& new_tab_page_url)
|
|||
WebView::Application::settings().set_new_tab_page_url(parsed_new_tab_page_url.release_value());
|
||||
}
|
||||
|
||||
void SettingsUI::set_languages(JsonValue const& languages)
|
||||
{
|
||||
auto parsed_languages = Settings::parse_json_languages(languages);
|
||||
WebView::Application::settings().set_languages(move(parsed_languages));
|
||||
|
||||
load_current_settings();
|
||||
}
|
||||
|
||||
void SettingsUI::load_available_engines()
|
||||
{
|
||||
JsonArray search_engines;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue