LibWeb+LibWebView+UI: Migrate to LibWebView's language settings

This commit is contained in:
Timothy Flynn 2025-04-03 13:53:02 -04:00 committed by Jelle Raaijmakers
parent f242920cc9
commit a3ea4881e7
Notes: github-actions[bot] 2025-04-04 08:17:32 +00:00
13 changed files with 14 additions and 148 deletions

View file

@ -7,8 +7,8 @@
#pragma once
#include <AK/Span.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibWeb/Loader/ResourceLoader.h>
namespace Web::HTML {
@ -16,10 +16,10 @@ namespace Web::HTML {
class NavigatorLanguageMixin {
public:
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-language
String language() const { return ResourceLoader::the().preferred_languages()[0]; }
String const& language() const { return ResourceLoader::the().preferred_languages()[0]; }
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-languages
Vector<String> languages() const { return ResourceLoader::the().preferred_languages(); }
ReadonlySpan<String> languages() const { return ResourceLoader::the().preferred_languages(); }
};
}