Serenity Operating System
1/*
2 * Copyright (c) 2022-2023, Tim Flynn <trflynn89@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9#include <AK/Optional.h>
10#include <AK/StringView.h>
11#include <AK/Vector.h>
12#include <LibLocale/Forward.h>
13#include <LibLocale/Locale.h>
14
15namespace Locale {
16
17// These are just the subset of fields in the CLDR required for ECMA-402.
18enum class TimeUnit {
19 Second,
20 Minute,
21 Hour,
22 Day,
23 Week,
24 Month,
25 Quarter,
26 Year,
27};
28
29struct RelativeTimeFormat {
30 PluralCategory plurality;
31 StringView pattern;
32};
33
34Optional<TimeUnit> time_unit_from_string(StringView time_unit);
35StringView time_unit_to_string(TimeUnit time_unit);
36
37ErrorOr<Vector<RelativeTimeFormat>> get_relative_time_format_patterns(StringView locale, TimeUnit time_unit, StringView tense_or_number, Style style);
38
39}