udisplayoptions.h 8.9 KB

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