3 namespace Drupal\Core\Language;
8 interface LanguageInterface {
11 * Special system language code (only applicable to UI language).
13 * Refers to the language used in Drupal and module/theme source code. Drupal
14 * uses the built-in text for English by default, but if configured to allow
15 * translation/customization of English, we need to differentiate between the
16 * built-in language and the English translation.
18 const LANGCODE_SYSTEM = 'system';
21 * The language code used when no language is explicitly assigned (yet).
23 * Should be used when language information is not available or cannot be
24 * determined. This special language code is useful when we know the data
25 * might have linguistic information, but we don't know the language.
27 * See http://www.w3.org/International/questions/qa-no-language#undetermined.
29 const LANGCODE_NOT_SPECIFIED = 'und';
32 * The language code used when the marked object has no linguistic content.
34 * Should be used when we explicitly know that the data referred has no
37 * See http://www.w3.org/International/questions/qa-no-language#nonlinguistic.
39 const LANGCODE_NOT_APPLICABLE = 'zxx';
42 * Language code referring to the default language of data, e.g. of an entity.
44 * See the BCP 47 syntax for defining private language tags:
45 * http://www.rfc-editor.org/rfc/bcp/bcp47.txt
47 const LANGCODE_DEFAULT = 'x-default';
50 * Language code referring to site's default language.
52 const LANGCODE_SITE_DEFAULT = 'site_default';
55 * The language state when referring to configurable languages.
57 const STATE_CONFIGURABLE = 1;
60 * The language state when referring to locked languages.
62 const STATE_LOCKED = 2;
65 * The language state used when referring to all languages.
70 * The language state used when referring to the site's default language.
72 const STATE_SITE_DEFAULT = 4;
75 * The type of language used to define the content language.
77 const TYPE_CONTENT = 'language_content';
80 * The type of language used to select the user interface.
82 const TYPE_INTERFACE = 'language_interface';
85 * The type of language used for URLs.
87 const TYPE_URL = 'language_url';
90 * Language written left to right. Possible value of $language->direction.
92 const DIRECTION_LTR = 'ltr';
95 * Language written right to left. Possible value of $language->direction.
97 const DIRECTION_RTL = 'rtl';
100 * Gets the name of the language.
103 * The human-readable name of the language (in the language that was
104 * used to construct this object).
106 public function getName();
109 * Gets the ID (language code).
114 public function getId();
117 * Gets the text direction (left-to-right or right-to-left).
120 * Either self::DIRECTION_LTR or self::DIRECTION_RTL.
122 public function getDirection();
125 * Gets the weight of the language.
128 * The weight, used to order languages with larger positive weights sinking
129 * items toward the bottom of lists.
131 public function getWeight();
134 * Returns whether this language is the default language.
137 * Whether the language is the default language.
139 public function isDefault();
142 * Returns whether this language is locked.
145 * Whether the language is locked or not.
147 public function isLocked();