summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibLocale/PluralRules.cpp
blob: 1f56f6cbe7bae1d8e629bb9863b50b4cef77c268 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibLocale/PluralRules.h>

namespace Locale {

PluralForm plural_form_from_string(StringView plural_form)
{
    if (plural_form == "cardinal"sv)
        return PluralForm::Cardinal;
    if (plural_form == "ordinal"sv)
        return PluralForm::Ordinal;
    VERIFY_NOT_REACHED();
}

StringView plural_form_to_string(PluralForm plural_form)
{
    switch (plural_form) {
    case PluralForm::Cardinal:
        return "cardinal"sv;
    case PluralForm::Ordinal:
        return "ordinal"sv;
    default:
        VERIFY_NOT_REACHED();
    }
}

PluralCategory __attribute__((weak)) determine_plural_category(StringView, PluralForm, PluralOperands)
{
    return PluralCategory::Other;
}

Span<PluralCategory const> __attribute__((weak)) available_plural_categories(StringView, PluralForm)
{
    static constexpr Array<PluralCategory, 1> categories { { PluralCategory::Other } };
    return categories.span();
}

PluralCategory __attribute__((weak)) determine_plural_range(StringView, PluralCategory, PluralCategory)
{
    return PluralCategory::Other;
}

}