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