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