annotate core/lib/Drupal/Core/Language/LanguageInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Language;
Chris@0 4
Chris@0 5 /**
Chris@0 6 * Defines a language.
Chris@0 7 */
Chris@0 8 interface LanguageInterface {
Chris@0 9
Chris@0 10 /**
Chris@0 11 * Special system language code (only applicable to UI language).
Chris@0 12 *
Chris@0 13 * Refers to the language used in Drupal and module/theme source code. Drupal
Chris@0 14 * uses the built-in text for English by default, but if configured to allow
Chris@0 15 * translation/customization of English, we need to differentiate between the
Chris@0 16 * built-in language and the English translation.
Chris@0 17 */
Chris@0 18 const LANGCODE_SYSTEM = 'system';
Chris@0 19
Chris@0 20 /**
Chris@0 21 * The language code used when no language is explicitly assigned (yet).
Chris@0 22 *
Chris@0 23 * Should be used when language information is not available or cannot be
Chris@0 24 * determined. This special language code is useful when we know the data
Chris@0 25 * might have linguistic information, but we don't know the language.
Chris@0 26 *
Chris@0 27 * See http://www.w3.org/International/questions/qa-no-language#undetermined.
Chris@0 28 */
Chris@0 29 const LANGCODE_NOT_SPECIFIED = 'und';
Chris@0 30
Chris@0 31 /**
Chris@0 32 * The language code used when the marked object has no linguistic content.
Chris@0 33 *
Chris@0 34 * Should be used when we explicitly know that the data referred has no
Chris@0 35 * linguistic content.
Chris@0 36 *
Chris@0 37 * See http://www.w3.org/International/questions/qa-no-language#nonlinguistic.
Chris@0 38 */
Chris@0 39 const LANGCODE_NOT_APPLICABLE = 'zxx';
Chris@0 40
Chris@0 41 /**
Chris@0 42 * Language code referring to the default language of data, e.g. of an entity.
Chris@0 43 *
Chris@0 44 * See the BCP 47 syntax for defining private language tags:
Chris@0 45 * http://www.rfc-editor.org/rfc/bcp/bcp47.txt
Chris@0 46 */
Chris@0 47 const LANGCODE_DEFAULT = 'x-default';
Chris@0 48
Chris@0 49 /**
Chris@0 50 * Language code referring to site's default language.
Chris@0 51 */
Chris@0 52 const LANGCODE_SITE_DEFAULT = 'site_default';
Chris@0 53
Chris@0 54 /**
Chris@0 55 * The language state when referring to configurable languages.
Chris@0 56 */
Chris@0 57 const STATE_CONFIGURABLE = 1;
Chris@0 58
Chris@0 59 /**
Chris@0 60 * The language state when referring to locked languages.
Chris@0 61 */
Chris@0 62 const STATE_LOCKED = 2;
Chris@0 63
Chris@0 64 /**
Chris@0 65 * The language state used when referring to all languages.
Chris@0 66 */
Chris@0 67 const STATE_ALL = 3;
Chris@0 68
Chris@0 69 /**
Chris@0 70 * The language state used when referring to the site's default language.
Chris@0 71 */
Chris@0 72 const STATE_SITE_DEFAULT = 4;
Chris@0 73
Chris@0 74 /**
Chris@0 75 * The type of language used to define the content language.
Chris@0 76 */
Chris@0 77 const TYPE_CONTENT = 'language_content';
Chris@0 78
Chris@0 79 /**
Chris@0 80 * The type of language used to select the user interface.
Chris@0 81 */
Chris@0 82 const TYPE_INTERFACE = 'language_interface';
Chris@0 83
Chris@0 84 /**
Chris@0 85 * The type of language used for URLs.
Chris@0 86 */
Chris@0 87 const TYPE_URL = 'language_url';
Chris@0 88
Chris@0 89 /**
Chris@0 90 * Language written left to right. Possible value of $language->direction.
Chris@0 91 */
Chris@0 92 const DIRECTION_LTR = 'ltr';
Chris@0 93
Chris@0 94 /**
Chris@0 95 * Language written right to left. Possible value of $language->direction.
Chris@0 96 */
Chris@0 97 const DIRECTION_RTL = 'rtl';
Chris@0 98
Chris@0 99 /**
Chris@0 100 * Gets the name of the language.
Chris@0 101 *
Chris@0 102 * @return string
Chris@0 103 * The human-readable name of the language (in the language that was
Chris@0 104 * used to construct this object).
Chris@0 105 */
Chris@0 106 public function getName();
Chris@0 107
Chris@0 108 /**
Chris@0 109 * Gets the ID (language code).
Chris@0 110 *
Chris@0 111 * @return string
Chris@0 112 * The language code.
Chris@0 113 */
Chris@0 114 public function getId();
Chris@0 115
Chris@0 116 /**
Chris@0 117 * Gets the text direction (left-to-right or right-to-left).
Chris@0 118 *
Chris@0 119 * @return string
Chris@0 120 * Either self::DIRECTION_LTR or self::DIRECTION_RTL.
Chris@0 121 */
Chris@0 122 public function getDirection();
Chris@0 123
Chris@0 124 /**
Chris@0 125 * Gets the weight of the language.
Chris@0 126 *
Chris@0 127 * @return int
Chris@0 128 * The weight, used to order languages with larger positive weights sinking
Chris@0 129 * items toward the bottom of lists.
Chris@0 130 */
Chris@0 131 public function getWeight();
Chris@0 132
Chris@0 133 /**
Chris@0 134 * Returns whether this language is the default language.
Chris@0 135 *
Chris@0 136 * @return bool
Chris@0 137 * Whether the language is the default language.
Chris@0 138 */
Chris@0 139 public function isDefault();
Chris@0 140
Chris@0 141 /**
Chris@0 142 * Returns whether this language is locked.
Chris@0 143 *
Chris@0 144 * @return bool
Chris@0 145 * Whether the language is locked or not.
Chris@0 146 */
Chris@0 147 public function isLocked();
Chris@0 148
Chris@0 149 }