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