2022-10-08 20:53:08 -06:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-12-04 18:02:33 +00:00
|
|
|
#include <AK/DeprecatedString.h>
|
2022-10-08 20:53:08 -06:00
|
|
|
#include <AK/Vector.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
class NavigatorLanguageMixin {
|
|
|
|
public:
|
|
|
|
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-language
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString language() const { return m_current_preferred_languages[0]; }
|
2022-10-08 20:53:08 -06:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-languages
|
|
|
|
// FIXME: The same object must be returned until the user agent needs to return different values, or values in a
|
|
|
|
// different order.
|
2022-12-04 18:02:33 +00:00
|
|
|
Vector<DeprecatedString> languages() const { return m_current_preferred_languages; }
|
2022-10-08 20:53:08 -06:00
|
|
|
|
|
|
|
protected:
|
2022-12-04 18:02:33 +00:00
|
|
|
Vector<DeprecatedString> m_current_preferred_languages = { "en-US" };
|
2022-10-08 20:53:08 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|