1 // © 2022 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 4 #ifndef __UDISPLAYOPTIONS_H__ 5 #define __UDISPLAYOPTIONS_H__ 6 7 #include "unicode/utypes.h" 8 9 #if !UCONFIG_NO_FORMATTING 10 11 /** 12 * \file 13 * \brief C API: Display options (enum types, values, helper functions) 14 * 15 * These display options are designed to be used in class DisplayOptions 16 * as a more modern version of the UDisplayContext mechanism. 17 */ 18 19 #include "unicode/uversion.h" 20 21 /** 22 * Represents all the grammatical cases that are supported by CLDR. 23 * 24 * @stable ICU 72 25 */ 26 typedef enum UDisplayOptionsGrammaticalCase { 27 /** 28 * A possible setting for GrammaticalCase. 29 * The grammatical case context to be used is unknown (this is the default value). 30 * @stable ICU 72 31 */ 32 UDISPOPT_GRAMMATICAL_CASE_UNDEFINED = 0, 33 /** @stable ICU 72 */ 34 UDISPOPT_GRAMMATICAL_CASE_ABLATIVE = 1, 35 /** @stable ICU 72 */ 36 UDISPOPT_GRAMMATICAL_CASE_ACCUSATIVE = 2, 37 /** @stable ICU 72 */ 38 UDISPOPT_GRAMMATICAL_CASE_COMITATIVE = 3, 39 /** @stable ICU 72 */ 40 UDISPOPT_GRAMMATICAL_CASE_DATIVE = 4, 41 /** @stable ICU 72 */ 42 UDISPOPT_GRAMMATICAL_CASE_ERGATIVE = 5, 43 /** @stable ICU 72 */ 44 UDISPOPT_GRAMMATICAL_CASE_GENITIVE = 6, 45 /** @stable ICU 72 */ 46 UDISPOPT_GRAMMATICAL_CASE_INSTRUMENTAL = 7, 47 /** @stable ICU 72 */ 48 UDISPOPT_GRAMMATICAL_CASE_LOCATIVE = 8, 49 /** @stable ICU 72 */ 50 UDISPOPT_GRAMMATICAL_CASE_LOCATIVE_COPULATIVE = 9, 51 /** @stable ICU 72 */ 52 UDISPOPT_GRAMMATICAL_CASE_NOMINATIVE = 10, 53 /** @stable ICU 72 */ 54 UDISPOPT_GRAMMATICAL_CASE_OBLIQUE = 11, 55 /** @stable ICU 72 */ 56 UDISPOPT_GRAMMATICAL_CASE_PREPOSITIONAL = 12, 57 /** @stable ICU 72 */ 58 UDISPOPT_GRAMMATICAL_CASE_SOCIATIVE = 13, 59 /** @stable ICU 72 */ 60 UDISPOPT_GRAMMATICAL_CASE_VOCATIVE = 14, 61 } UDisplayOptionsGrammaticalCase; 62 63 /** 64 * @param grammaticalCase The grammatical case. 65 * @return the lowercase CLDR keyword string for the grammatical case. 66 * 67 * @stable ICU 72 68 */ 69 U_CAPI const char * U_EXPORT2 70 udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase grammaticalCase); 71 72 /** 73 * @param identifier in lower case such as "dative" or "nominative" 74 * @return the plural category corresponding to the identifier, or `UDISPOPT_GRAMMATICAL_CASE_UNDEFINED` 75 * 76 * @stable ICU 72 77 */ 78 U_CAPI UDisplayOptionsGrammaticalCase U_EXPORT2 79 udispopt_fromGrammaticalCaseIdentifier(const char *identifier); 80 81 /** 82 * Standard CLDR plural form/category constants. 83 * See https://www.unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules 84 * 85 * @stable ICU 72 86 */ 87 typedef enum UDisplayOptionsPluralCategory { 88 89 /** 90 * A possible setting for PluralCategory. 91 * The plural category case context to be used is unknown (this is the default value). 92 * 93 * @stable ICU 72 94 */ 95 UDISPOPT_PLURAL_CATEGORY_UNDEFINED = 0, 96 /** @stable ICU 72 */ 97 UDISPOPT_PLURAL_CATEGORY_ZERO = 1, 98 /** @stable ICU 72 */ 99 UDISPOPT_PLURAL_CATEGORY_ONE = 2, 100 /** @stable ICU 72 */ 101 UDISPOPT_PLURAL_CATEGORY_TWO = 3, 102 /** @stable ICU 72 */ 103 UDISPOPT_PLURAL_CATEGORY_FEW = 4, 104 /** @stable ICU 72 */ 105 UDISPOPT_PLURAL_CATEGORY_MANY = 5, 106 /** @stable ICU 72 */ 107 UDISPOPT_PLURAL_CATEGORY_OTHER = 6, 108 } UDisplayOptionsPluralCategory; 109 110 /** 111 * @param pluralCategory The plural category. 112 * @return the lowercase CLDR identifier string for the plural category. 113 * 114 * @stable ICU 72 115 */ 116 U_CAPI const char * U_EXPORT2 117 udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory pluralCategory); 118 119 /** 120 * @param identifier for example "few" or "other" 121 * @return the plural category corresponding to the identifier (plural keyword), 122 * or `UDISPOPT_PLURAL_CATEGORY_UNDEFINED` 123 * 124 * @stable ICU 72 125 */ 126 U_CAPI UDisplayOptionsPluralCategory U_EXPORT2 127 udispopt_fromPluralCategoryIdentifier(const char *identifier); 128 129 /** 130 * Represents all the grammatical noun classes that are supported by CLDR. 131 * 132 * @stable ICU 72. 133 */ 134 typedef enum UDisplayOptionsNounClass { 135 /** 136 * A possible setting for NounClass. 137 * The noun class case context to be used is unknown (this is the default value). 138 * 139 * @stable ICU 72 140 */ 141 UDISPOPT_NOUN_CLASS_UNDEFINED = 0, 142 /** @stable ICU 72 */ 143 UDISPOPT_NOUN_CLASS_OTHER = 1, 144 /** @stable ICU 72 */ 145 UDISPOPT_NOUN_CLASS_NEUTER = 2, 146 /** @stable ICU 72 */ 147 UDISPOPT_NOUN_CLASS_FEMININE = 3, 148 /** @stable ICU 72 */ 149 UDISPOPT_NOUN_CLASS_MASCULINE = 4, 150 /** @stable ICU 72 */ 151 UDISPOPT_NOUN_CLASS_ANIMATE = 5, 152 /** @stable ICU 72 */ 153 UDISPOPT_NOUN_CLASS_INANIMATE = 6, 154 /** @stable ICU 72 */ 155 UDISPOPT_NOUN_CLASS_PERSONAL = 7, 156 /** @stable ICU 72 */ 157 UDISPOPT_NOUN_CLASS_COMMON = 8, 158 } UDisplayOptionsNounClass; 159 160 /** 161 * @param nounClass The noun class. 162 * @return the lowercase CLDR keyword string for the noun class. 163 * 164 * @stable ICU 72 165 */ 166 U_CAPI const char * U_EXPORT2 167 udispopt_getNounClassIdentifier(UDisplayOptionsNounClass nounClass); 168 169 /** 170 * @param identifier in lower case such as "feminine" or "masculine" 171 * @return the plural category corresponding to the identifier, or `UDISPOPT_NOUN_CLASS_UNDEFINED` 172 * 173 * @stable ICU 72 174 */ 175 U_CAPI UDisplayOptionsNounClass U_EXPORT2 176 udispopt_fromNounClassIdentifier(const char *identifier); 177 178 /** 179 * Represents all the capitalization options. 180 * 181 * @stable ICU 72 182 */ 183 typedef enum UDisplayOptionsCapitalization { 184 /** 185 * A possible setting for Capitalization. 186 * The capitalization context to be used is unknown (this is the default value). 187 * 188 * @stable ICU 72 189 */ 190 UDISPOPT_CAPITALIZATION_UNDEFINED = 0, 191 192 /** 193 * The capitalization context if a date, date symbol or display name is to be 194 * formatted with capitalization appropriate for the beginning of a sentence. 195 * 196 * @stable ICU 72 197 */ 198 UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE = 1, 199 200 /** 201 * The capitalization context if a date, date symbol or display name is to be 202 * formatted with capitalization appropriate for the middle of a sentence. 203 * 204 * @stable ICU 72 205 */ 206 UDISPOPT_CAPITALIZATION_MIDDLE_OF_SENTENCE = 2, 207 208 /** 209 * The capitalization context if a date, date symbol or display name is to be 210 * formatted with capitalization appropriate for stand-alone usage such as an 211 * isolated name on a calendar page. 212 * 213 * @stable ICU 72 214 */ 215 UDISPOPT_CAPITALIZATION_STANDALONE = 3, 216 217 /** 218 * The capitalization context if a date, date symbol or display name is to be 219 * formatted with capitalization appropriate for a user-interface list or menu item. 220 * 221 * @stable ICU 72 222 */ 223 UDISPOPT_CAPITALIZATION_UI_LIST_OR_MENU = 4, 224 } UDisplayOptionsCapitalization; 225 226 /** 227 * Represents all the dialect handlings. 228 * 229 * @stable ICU 72 230 */ 231 typedef enum UDisplayOptionsNameStyle { 232 /** 233 * A possible setting for NameStyle. 234 * The NameStyle context to be used is unknown (this is the default value). 235 * 236 * @stable ICU 72 237 */ 238 UDISPOPT_NAME_STYLE_UNDEFINED = 0, 239 240 /** 241 * Use standard names when generating a locale name, 242 * e.g. en_GB displays as 'English (United Kingdom)'. 243 * 244 * @stable ICU 72 245 */ 246 UDISPOPT_NAME_STYLE_STANDARD_NAMES = 1, 247 248 /** 249 * Use dialect names, when generating a locale name, 250 * e.g. en_GB displays as 'British English'. 251 * 252 * @stable ICU 72 253 */ 254 UDISPOPT_NAME_STYLE_DIALECT_NAMES = 2, 255 } UDisplayOptionsNameStyle; 256 257 /** 258 * Represents all the display lengths. 259 * 260 * @stable ICU 72 261 */ 262 typedef enum UDisplayOptionsDisplayLength { 263 /** 264 * A possible setting for DisplayLength. 265 * The DisplayLength context to be used is unknown (this is the default value). 266 * 267 * @stable ICU 72 268 */ 269 UDISPOPT_DISPLAY_LENGTH_UNDEFINED = 0, 270 271 /** 272 * Uses full names when generating a locale name, 273 * e.g. "United States" for US. 274 * 275 * @stable ICU 72 276 */ 277 UDISPOPT_DISPLAY_LENGTH_FULL = 1, 278 279 /** 280 * Use short names when generating a locale name, 281 * e.g. "U.S." for US. 282 * 283 * @stable ICU 72 284 */ 285 UDISPOPT_DISPLAY_LENGTH_SHORT = 2, 286 } UDisplayOptionsDisplayLength; 287 288 /** 289 * Represents all the substitute handling. 290 * 291 * @stable ICU 72 292 */ 293 typedef enum UDisplayOptionsSubstituteHandling { 294 295 /** 296 * A possible setting for SubstituteHandling. 297 * The SubstituteHandling context to be used is unknown (this is the default value). 298 * 299 * @stable ICU 72 300 */ 301 UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED = 0, 302 303 /** 304 * Returns a fallback value (e.g., the input code) when no data is available. 305 * This is the default behaviour. 306 * 307 * @stable ICU 72 308 */ 309 UDISPOPT_SUBSTITUTE_HANDLING_SUBSTITUTE = 1, 310 311 /** 312 * Returns a null value when no data is available. 313 * 314 * @stable ICU 72 315 */ 316 UDISPOPT_SUBSTITUTE_HANDLING_NO_SUBSTITUTE = 2, 317 } UDisplayOptionsSubstituteHandling; 318 319 #endif /* #if !UCONFIG_NO_FORMATTING */ 320 321 #endif // __UDISPLAYOPTIONS_H__ 322