2022-01-26 18:49:58 +03:00
|
|
|
/*
|
2023-02-03 05:37:08 +03:00
|
|
|
* Copyright (c) 2022-2023, Tim Flynn <trflynn89@serenityos.org>
|
2022-01-26 18:49:58 +03:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Optional.h>
|
|
|
|
#include <AK/StringView.h>
|
|
|
|
#include <AK/Vector.h>
|
2022-09-02 19:11:30 +03:00
|
|
|
#include <LibLocale/Forward.h>
|
|
|
|
#include <LibLocale/Locale.h>
|
2022-01-26 18:49:58 +03:00
|
|
|
|
2022-09-02 19:01:10 +03:00
|
|
|
namespace Locale {
|
2022-01-26 18:49:58 +03:00
|
|
|
|
|
|
|
// These are just the subset of fields in the CLDR required for ECMA-402.
|
|
|
|
enum class TimeUnit {
|
|
|
|
Second,
|
|
|
|
Minute,
|
|
|
|
Hour,
|
|
|
|
Day,
|
|
|
|
Week,
|
|
|
|
Month,
|
|
|
|
Quarter,
|
|
|
|
Year,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RelativeTimeFormat {
|
2022-07-07 20:59:46 +03:00
|
|
|
PluralCategory plurality;
|
2022-01-26 18:49:58 +03:00
|
|
|
StringView pattern;
|
|
|
|
};
|
|
|
|
|
|
|
|
Optional<TimeUnit> time_unit_from_string(StringView time_unit);
|
|
|
|
StringView time_unit_to_string(TimeUnit time_unit);
|
|
|
|
|
2023-08-22 23:45:22 +03:00
|
|
|
Vector<RelativeTimeFormat> get_relative_time_format_patterns(StringView locale, TimeUnit time_unit, StringView tense_or_number, Style style);
|
2022-01-26 18:49:58 +03:00
|
|
|
|
|
|
|
}
|