LanguageInterface
interface LanguageInterface (View source)
Defines a language.
Constants
| LANGCODE_SYSTEM |
Special system language code (only applicable to UI language). Refers to the language used in Drupal and module/theme source code. Drupal uses the built-in text for English by default, but if configured to allow translation/customization of English, we need to differentiate between the built-in language and the English translation. |
| LANGCODE_NOT_SPECIFIED |
The language code used when no language is explicitly assigned (yet). Should be used when language information is not available or cannot be determined. This special language code is useful when we know the data might have linguistic information, but we don't know the language. See http://www.w3.org/International/questions/qa-no-language#undetermined. |
| LANGCODE_NOT_APPLICABLE |
The language code used when the marked object has no linguistic content. Should be used when we explicitly know that the data referred has no linguistic content. See http://www.w3.org/International/questions/qa-no-language#nonlinguistic. |
| LANGCODE_DEFAULT |
Language code referring to the default language of data, e.g. of an entity. See the BCP 47 syntax for defining private language tags: http://www.rfc-editor.org/rfc/bcp/bcp47.txt |
| LANGCODE_SITE_DEFAULT |
Language code referring to site's default language. |
| VALID_LANGCODE_REGEX |
A regex for validating language codes according to W3C specifications. |
| STATE_CONFIGURABLE |
The language state when referring to configurable languages. |
| STATE_LOCKED |
The language state when referring to locked languages. |
| STATE_ALL |
The language state used when referring to all languages. |
| STATE_SITE_DEFAULT |
The language state used when referring to the site's default language. |
| TYPE_CONTENT |
The type of language used to define the content language. |
| TYPE_INTERFACE |
The type of language used to select the user interface. |
| TYPE_URL |
The type of language used for URLs. |
| DIRECTION_LTR |
Language written left to right. Possible value of $language->direction. |
| DIRECTION_RTL |
Language written right to left. Possible value of $language->direction. |
Methods
Gets the name of the language.
Gets the ID (language code).
Gets the text direction (left-to-right or right-to-left).
Gets the weight of the language.
Returns whether this language is the default language.
Returns whether this language is locked.
Details
string
getName()
Gets the name of the language.
string
getId()
Gets the ID (language code).
string
getDirection()
Gets the text direction (left-to-right or right-to-left).
int
getWeight()
Gets the weight of the language.
bool
isDefault()
Returns whether this language is the default language.
bool
isLocked()
Returns whether this language is locked.