summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibLocale/RelativeTimeFormat.h
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-09-02 12:11:30 -0400
committerTim Flynn <trflynn89@pm.me>2022-09-05 14:37:16 -0400
commit43a3471298c429530aaf8c8cf2e2c3563079a9e4 (patch)
tree72a8c7adde28e2aa529e4810919f4421122ddb5b /Userland/Libraries/LibLocale/RelativeTimeFormat.h
parentff48220dcae7109de994a727bea24a25a6649412 (diff)
downloadserenity-43a3471298c429530aaf8c8cf2e2c3563079a9e4.zip
LibLocale: Move locale source files to the LibLocale folder
These are still included in LibUnicode, but this updates their location and the include paths of other files which include them.
Diffstat (limited to 'Userland/Libraries/LibLocale/RelativeTimeFormat.h')
-rw-r--r--Userland/Libraries/LibLocale/RelativeTimeFormat.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/Userland/Libraries/LibLocale/RelativeTimeFormat.h b/Userland/Libraries/LibLocale/RelativeTimeFormat.h
new file mode 100644
index 0000000000..1a1914328b
--- /dev/null
+++ b/Userland/Libraries/LibLocale/RelativeTimeFormat.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Optional.h>
+#include <AK/StringView.h>
+#include <AK/Vector.h>
+#include <LibLocale/Forward.h>
+#include <LibLocale/Locale.h>
+
+namespace Locale {
+
+// 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 {
+ PluralCategory plurality;
+ StringView pattern;
+};
+
+Optional<TimeUnit> time_unit_from_string(StringView time_unit);
+StringView time_unit_to_string(TimeUnit time_unit);
+
+Vector<RelativeTimeFormat> get_relative_time_format_patterns(StringView locale, TimeUnit time_unit, StringView tense_or_number, Style style);
+
+}