summaryrefslogtreecommitdiffstats
path: root/intl/icu/source/i18n/unicode/udisplayoptions.h
blob: 1ecdf1d8e94463fd1b75f3f13690f466d0c4df2b (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
// © 2022 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html

#ifndef __UDISPLAYOPTIONS_H__
#define __UDISPLAYOPTIONS_H__

#include "unicode/utypes.h"

#if !UCONFIG_NO_FORMATTING

/**
 * \file
 * \brief C API: Display options (enum types, values, helper functions)
 *
 * These display options are designed to be used in class DisplayOptions
 * as a more modern version of the UDisplayContext mechanism.
 */

#include "unicode/uversion.h"

#ifndef U_HIDE_DRAFT_API

/**
 * Represents all the grammatical cases that are supported by CLDR.
 *
 * @draft ICU 72
 */
typedef enum UDisplayOptionsGrammaticalCase {
    /**
     * A possible setting for GrammaticalCase.
     * The grammatical case context to be used is unknown (this is the default value).
     * @draft ICU 72
     */
    UDISPOPT_GRAMMATICAL_CASE_UNDEFINED = 0,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_ABLATIVE = 1,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_ACCUSATIVE = 2,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_COMITATIVE = 3,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_DATIVE = 4,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_ERGATIVE = 5,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_GENITIVE = 6,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_INSTRUMENTAL = 7,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_LOCATIVE = 8,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_LOCATIVE_COPULATIVE = 9,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_NOMINATIVE = 10,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_OBLIQUE = 11,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_PREPOSITIONAL = 12,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_SOCIATIVE = 13,
    /** @draft ICU 72 */
    UDISPOPT_GRAMMATICAL_CASE_VOCATIVE = 14,
} UDisplayOptionsGrammaticalCase;

/**
 * @param grammaticalCase The grammatical case.
 * @return the lowercase CLDR keyword string for the grammatical case.
 *
 * @draft ICU 72
 */
U_CAPI const char * U_EXPORT2
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase grammaticalCase);

/**
 * @param identifier in lower case such as "dative" or "nominative"
 * @return the plural category corresponding to the identifier, or `UDISPOPT_GRAMMATICAL_CASE_UNDEFINED`
 *
 * @draft ICU 72
 */
U_CAPI UDisplayOptionsGrammaticalCase U_EXPORT2
udispopt_fromGrammaticalCaseIdentifier(const char *identifier);

/**
 * Standard CLDR plural form/category constants.
 * See https://www.unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules
 *
 * @draft ICU 72
 */
typedef enum UDisplayOptionsPluralCategory {

    /**
     * A possible setting for PluralCategory.
     * The plural category case context to be used is unknown (this is the default value).
     *
     * @draft ICU 72
     */
    UDISPOPT_PLURAL_CATEGORY_UNDEFINED = 0,
    /** @draft ICU 72 */
    UDISPOPT_PLURAL_CATEGORY_ZERO = 1,
    /** @draft ICU 72 */
    UDISPOPT_PLURAL_CATEGORY_ONE = 2,
    /** @draft ICU 72 */
    UDISPOPT_PLURAL_CATEGORY_TWO = 3,
    /** @draft ICU 72 */
    UDISPOPT_PLURAL_CATEGORY_FEW = 4,
    /** @draft ICU 72 */
    UDISPOPT_PLURAL_CATEGORY_MANY = 5,
    /** @draft ICU 72 */
    UDISPOPT_PLURAL_CATEGORY_OTHER = 6,
} UDisplayOptionsPluralCategory;

/**
 * @param pluralCategory The plural category.
 * @return the lowercase CLDR identifier string for the plural category.
 *
 * @draft ICU 72
 */
U_CAPI const char * U_EXPORT2
udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory pluralCategory);

/**
 * @param identifier for example "few" or "other"
 * @return the plural category corresponding to the identifier (plural keyword),
 *         or `UDISPOPT_PLURAL_CATEGORY_UNDEFINED`
 *
 * @draft ICU 72
 */
U_CAPI UDisplayOptionsPluralCategory U_EXPORT2
udispopt_fromPluralCategoryIdentifier(const char *identifier);

/**
 * Represents all the grammatical noun classes that are supported by CLDR.
 *
 * @draft ICU 72.
 */
typedef enum UDisplayOptionsNounClass {
    /**
     * A possible setting for NounClass.
     * The noun class case context to be used is unknown (this is the default value).
     *
     * @draft ICU 72
     */
    UDISPOPT_NOUN_CLASS_UNDEFINED = 0,
    /** ICU 72 */
    UDISPOPT_NOUN_CLASS_OTHER = 1,
    /** ICU 72 */
    UDISPOPT_NOUN_CLASS_NEUTER = 2,
    /** ICU 72 */
    UDISPOPT_NOUN_CLASS_FEMININE = 3,
    /** ICU 72 */
    UDISPOPT_NOUN_CLASS_MASCULINE = 4,
    /** ICU 72 */
    UDISPOPT_NOUN_CLASS_ANIMATE = 5,
    /** ICU 72 */
    UDISPOPT_NOUN_CLASS_INANIMATE = 6,
    /** ICU 72 */
    UDISPOPT_NOUN_CLASS_PERSONAL = 7,
    /** ICU 72 */
    UDISPOPT_NOUN_CLASS_COMMON = 8,
} UDisplayOptionsNounClass;

/**
 * @param nounClass The noun class.
 * @return the lowercase CLDR keyword string for the noun class.
 *
 * @draft ICU 72
 */
U_CAPI const char * U_EXPORT2
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass nounClass);

/**
 * @param identifier in lower case such as "feminine" or "masculine"
 * @return the plural category corresponding to the identifier, or `UDISPOPT_NOUN_CLASS_UNDEFINED`
 *
 * @draft ICU 72
 */
U_CAPI UDisplayOptionsNounClass U_EXPORT2
udispopt_fromNounClassIdentifier(const char *identifier);

/**
 * Represents all the capitalization options.
 *
 * @draft ICU 72
 */
typedef enum UDisplayOptionsCapitalization {
    /**
     * A possible setting for Capitalization.
     * The capitalization context to be used is unknown (this is the default value).
     *
     * @draft ICU 72
     */
    UDISPOPT_CAPITALIZATION_UNDEFINED = 0,

    /**
     * The capitalization context if a date, date symbol or display name is to be
     * formatted with capitalization appropriate for the beginning of a sentence.
     *
     * @draft ICU 72
     */
    UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE = 1,

    /**
     * The capitalization context if a date, date symbol or display name is to be
     * formatted with capitalization appropriate for the middle of a sentence.
     *
     * @draft ICU 72
     */
    UDISPOPT_CAPITALIZATION_MIDDLE_OF_SENTENCE = 2,

    /**
     * The capitalization context if a date, date symbol or display name is to be
     * formatted with capitalization appropriate for stand-alone usage such as an
     * isolated name on a calendar page.
     *
     * @draft ICU 72
     */
    UDISPOPT_CAPITALIZATION_STANDALONE = 3,

    /**
     * The capitalization context if a date, date symbol or display name is to be
     * formatted with capitalization appropriate for a user-interface list or menu item.
     *
     * @draft ICU 72
     */
    UDISPOPT_CAPITALIZATION_UI_LIST_OR_MENU = 4,
} UDisplayOptionsCapitalization;

/**
 * Represents all the dialect handlings.
 *
 * @draft ICU 72
 */
typedef enum UDisplayOptionsNameStyle {
    /**
     * A possible setting for NameStyle.
     * The NameStyle context to be used is unknown (this is the default value).
     *
     * @draft ICU 72
     */
    UDISPOPT_NAME_STYLE_UNDEFINED = 0,

    /**
     * Use standard names when generating a locale name,
     * e.g. en_GB displays as 'English (United Kingdom)'.
     *
     * @draft ICU 72
     */
    UDISPOPT_NAME_STYLE_STANDARD_NAMES = 1,

    /**
     * Use dialect names, when generating a locale name,
     * e.g. en_GB displays as 'British English'.
     *
     * @draft ICU 72
     */
    UDISPOPT_NAME_STYLE_DIALECT_NAMES = 2,
} UDisplayOptionsNameStyle;

/**
 * Represents all the display lengths.
 *
 * @draft ICU 72
 */
typedef enum UDisplayOptionsDisplayLength {
    /**
     * A possible setting for DisplayLength.
     * The DisplayLength context to be used is unknown (this is the default value).
     *
     * @draft ICU 72
     */
    UDISPOPT_DISPLAY_LENGTH_UNDEFINED = 0,

    /**
     * Uses full names when generating a locale name,
     * e.g. "United States" for US.
     *
     * @draft ICU 72
     */
    UDISPOPT_DISPLAY_LENGTH_FULL = 1,

    /**
     * Use short names when generating a locale name,
     * e.g. "U.S." for US.
     *
     * @draft ICU 72
     */
    UDISPOPT_DISPLAY_LENGTH_SHORT = 2,
} UDisplayOptionsDisplayLength;

/**
 * Represents all the substitute handling.
 *
 * @draft ICU 72
 */
typedef enum UDisplayOptionsSubstituteHandling {

    /**
     * A possible setting for SubstituteHandling.
     * The SubstituteHandling context to be used is unknown (this is the default value).
     *
     * @draft ICU 72
     */
    UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED = 0,

    /**
     * Returns a fallback value (e.g., the input code) when no data is available.
     * This is the default behaviour.
     *
     * @draft ICU 72
     */
    UDISPOPT_SUBSTITUTE_HANDLING_SUBSTITUTE = 1,

    /**
     * Returns a null value when no data is available.
     *
     * @draft ICU 72
     */
    UDISPOPT_SUBSTITUTE_HANDLING_NO_SUBSTITUTE = 2,
} UDisplayOptionsSubstituteHandling;

#endif // U_HIDE_DRAFT_API

#endif /* #if !UCONFIG_NO_FORMATTING */

#endif // __UDISPLAYOPTIONS_H__