mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS: Convert Intl.DisplayNames to use Unicode::Style
This commit is contained in:
committed by
Linus Groh
parent
bced4e9324
commit
25e67f63a2
Notes:
sideshowbarker
2024-07-17 20:14:58 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/25e67f63a24 Pull-request: https://github.com/SerenityOS/serenity/pull/12131 Reviewed-by: https://github.com/linusg ✅
@@ -10,19 +10,13 @@
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibUnicode/Locale.h>
|
||||
|
||||
namespace JS::Intl {
|
||||
|
||||
class DisplayNames final : public Object {
|
||||
JS_OBJECT(DisplayNames, Object);
|
||||
|
||||
enum class Style {
|
||||
Invalid,
|
||||
Narrow,
|
||||
Short,
|
||||
Long,
|
||||
};
|
||||
|
||||
enum class Type {
|
||||
Invalid,
|
||||
Language,
|
||||
@@ -51,9 +45,9 @@ public:
|
||||
String const& locale() const { return m_locale; }
|
||||
void set_locale(String locale) { m_locale = move(locale); }
|
||||
|
||||
Style style() const { return m_style; }
|
||||
void set_style(StringView style);
|
||||
StringView style_string() const;
|
||||
Unicode::Style style() const { return m_style; }
|
||||
void set_style(StringView style) { m_style = Unicode::style_from_string(style); }
|
||||
StringView style_string() const { return Unicode::style_to_string(m_style); }
|
||||
|
||||
Type type() const { return m_type; }
|
||||
void set_type(StringView type);
|
||||
@@ -70,7 +64,7 @@ public:
|
||||
|
||||
private:
|
||||
String m_locale; // [[Locale]]
|
||||
Style m_style { Style::Invalid }; // [[Style]]
|
||||
Unicode::Style m_style { Unicode::Style::Long }; // [[Style]]
|
||||
Type m_type { Type::Invalid }; // [[Type]]
|
||||
Fallback m_fallback { Fallback::Invalid }; // [[Fallback]]
|
||||
Optional<LanguageDisplay> m_language_display {}; // [[LanguageDisplay]]
|
||||
|
||||
Reference in New Issue
Block a user