1// © 2016 and later: Unicode, Inc. and others. 2// License & terms of use: http://www.unicode.org/copyright.html#License 3/* 4 ******************************************************************************* 5 * Copyright (C) 2012-2015, International Business Machines Corporation and * 6 * others. All Rights Reserved. * 7 ******************************************************************************* 8 */ 9package com.ibm.icu.text; 10 11/** 12 * Display context settings. 13 * Note, the specific numeric values are internal and may change. 14 * @stable ICU 51 15 */ 16public enum DisplayContext { 17 /** 18 * ================================ 19 * Settings for DIALECT_HANDLING (use one) 20 */ 21 /** 22 * A possible setting for DIALECT_HANDLING: 23 * use standard names when generating a locale name, 24 * e.g. en_GB displays as 'English (United Kingdom)'. 25 * @stable ICU 51 26 */ 27 STANDARD_NAMES(Type.DIALECT_HANDLING, 0), 28 /** 29 * A possible setting for DIALECT_HANDLING: 30 * use dialect names, when generating a locale name, 31 * e.g. en_GB displays as 'British English'. 32 * @stable ICU 51 33 */ 34 DIALECT_NAMES(Type.DIALECT_HANDLING, 1), 35 /** 36 * ================================ 37 * Settings for CAPITALIZATION (use one) 38 */ 39 /** 40 * A possible setting for CAPITALIZATION: 41 * The capitalization context to be used is unknown (this is the default value). 42 * @stable ICU 51 43 */ 44 CAPITALIZATION_NONE(Type.CAPITALIZATION, 0), 45 /** 46 * A possible setting for CAPITALIZATION: 47 * The capitalization context if a date, date symbol or display name is to be 48 * formatted with capitalization appropriate for the middle of a sentence. 49 * @stable ICU 51 50 */ 51 CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE(Type.CAPITALIZATION, 1), 52 /** 53 * A possible setting for CAPITALIZATION: 54 * The capitalization context if a date, date symbol or display name is to be 55 * formatted with capitalization appropriate for the beginning of a sentence. 56 * @stable ICU 51 57 */ 58 CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE(Type.CAPITALIZATION, 2), 59 /** 60 * A possible setting for CAPITALIZATION: 61 * The capitalization context if a date, date symbol or display name is to be 62 * formatted with capitalization appropriate for a user-interface list or menu item. 63 * @stable ICU 51 64 */ 65 CAPITALIZATION_FOR_UI_LIST_OR_MENU(Type.CAPITALIZATION, 3), 66 /** 67 * A possible setting for CAPITALIZATION: 68 * The capitalization context if a date, date symbol or display name is to be 69 * formatted with capitalization appropriate for stand-alone usage such as an 70 * isolated name on a calendar page. 71 * @stable ICU 51 72 */ 73 CAPITALIZATION_FOR_STANDALONE(Type.CAPITALIZATION, 4), 74 /** 75 * ================================ 76 * Settings for DISPLAY_LENGTH (use one) 77 */ 78 /** 79 * A possible setting for DISPLAY_LENGTH: 80 * use full names when generating a locale name, 81 * e.g. "United States" for US. 82 * @stable ICU 54 83 */ 84 LENGTH_FULL(Type.DISPLAY_LENGTH, 0), 85 /** 86 * A possible setting for DISPLAY_LENGTH: 87 * use short names when generating a locale name, 88 * e.g. "U.S." for US. 89 * @stable ICU 54 90 */ 91 LENGTH_SHORT(Type.DISPLAY_LENGTH, 1), 92 /** 93 * ================================ 94 * Settings for SUBSTITUTE_HANDLING (choose one) 95 */ 96 /** 97 * A possible setting for SUBSTITUTE_HANDLING: 98 * Returns a fallback value (e.g., the input code) when no data is available. 99 * This is the default behavior. 100 * @draft ICU 58 101 * @provisional This API might change or be removed in a future release. 102 */ 103 SUBSTITUTE(Type.SUBSTITUTE_HANDLING, 0), 104 /** 105 * A possible setting for SUBSTITUTE_HANDLING: 106 * Returns a null value when no data is available. 107 * @draft ICU 58 108 * @provisional This API might change or be removed in a future release. 109 */ 110 NO_SUBSTITUTE(Type.SUBSTITUTE_HANDLING, 1); 111 112 /** 113 * Type values for DisplayContext 114 * @stable ICU 51 115 */ 116 public enum Type { 117 /** 118 * DIALECT_HANDLING can be set to STANDARD_NAMES or DIALECT_NAMES. 119 * @stable ICU 51 120 */ 121 DIALECT_HANDLING, 122 /** 123 * CAPITALIZATION can be set to one of CAPITALIZATION_NONE through 124 * CAPITALIZATION_FOR_STANDALONE. 125 * @stable ICU 51 126 */ 127 CAPITALIZATION, 128 /** 129 * DISPLAY_LENGTH can be set to LENGTH_FULL or LENGTH_SHORT. 130 * @stable ICU 54 131 */ 132 DISPLAY_LENGTH, 133 /** 134 * SUBSTITUTE_HANDLING can be set to SUBSTITUTE or NO_SUBSTITUTE. 135 * @draft ICU 58 136 * @provisional This API might change or be removed in a future release. 137 */ 138 SUBSTITUTE_HANDLING 139 } 140 141 private final Type type; 142 private final int value; 143 private DisplayContext(Type type, int value) { 144 this.type = type; 145 this.value = value; 146 } 147 /** 148 * Get the Type part of the enum item 149 * (e.g. CAPITALIZATION) 150 * @stable ICU 51 151 */ 152 public Type type() { 153 return type; 154 } 155 /** 156 * Get the value part of the enum item 157 * (e.g. CAPITALIZATION_FOR_STANDALONE) 158 * @stable ICU 51 159 */ 160 public int value() { 161 return value; 162 } 163} 164