1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

LibJS: Port Intl locale resolution to String

This commit is contained in:
Timothy Flynn 2023-01-19 13:13:57 -05:00 committed by Linus Groh
parent 2f1184ccdb
commit bb4b6d8ce3
20 changed files with 208 additions and 205 deletions

View file

@ -9,6 +9,7 @@
#include <AK/Array.h>
#include <AK/DeprecatedString.h>
#include <AK/String.h>
#include <LibJS/Runtime/Intl/AbstractOperations.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/Temporal/Duration.h>
@ -51,18 +52,18 @@ public:
virtual ~DurationFormat() override = default;
void set_locale(DeprecatedString locale) { m_locale = move(locale); }
DeprecatedString const& locale() const { return m_locale; }
void set_locale(String locale) { m_locale = move(locale); }
String const& locale() const { return m_locale; }
void set_data_locale(DeprecatedString data_locale) { m_data_locale = move(data_locale); }
DeprecatedString const& data_locale() const { return m_data_locale; }
void set_data_locale(String data_locale) { m_data_locale = move(data_locale); }
String const& data_locale() const { return m_data_locale; }
void set_numbering_system(DeprecatedString numbering_system) { m_numbering_system = move(numbering_system); }
DeprecatedString const& numbering_system() const { return m_numbering_system; }
void set_numbering_system(String numbering_system) { m_numbering_system = move(numbering_system); }
String const& numbering_system() const { return m_numbering_system; }
void set_style(StringView style) { m_style = style_from_string(style); }
Style style() const { return m_style; }
DeprecatedString style_string() const { return style_to_string(m_style); }
StringView style_string() const { return style_to_string(m_style); }
void set_years_style(StringView years_style) { m_years_style = date_style_from_string(years_style); }
ValueStyle years_style() const { return m_years_style; }
@ -160,9 +161,9 @@ private:
static Display display_from_string(StringView display);
static StringView display_to_string(Display);
DeprecatedString m_locale; // [[Locale]]
DeprecatedString m_data_locale; // [[DataLocale]]
DeprecatedString m_numbering_system; // [[NumberingSystem]]
String m_locale; // [[Locale]]
String m_data_locale; // [[DataLocale]]
String m_numbering_system; // [[NumberingSystem]]
Style m_style { Style::Long }; // [[Style]]
ValueStyle m_years_style { ValueStyle::Long }; // [[YearsStyle]]
Display m_years_display { Display::Auto }; // [[YearsDisplay]]