Drupal 8  8.0.2
Language Class Reference
Inheritance diagram for Language:

Public Member Functions

 __construct (array $values=array())
 
 getName ()
 
 getId ()
 
 getDirection ()
 
 getWeight ()
 
 isDefault ()
 
 isLocked ()
 

Static Public Member Functions

static sort (&$languages)
 

Static Public Attributes

static $defaultValues
 

Static Protected Member Functions

static getDefaultLangcode ()
 

Protected Attributes

 $name = ''
 
 $id = ''
 
 $direction = self::DIRECTION_LTR
 
 $weight = 0
 
 $locked = FALSE
 

Additional Inherited Members

- Data Fields inherited from LanguageInterface
const LANGCODE_SYSTEM = 'system'
 
const LANGCODE_NOT_SPECIFIED = 'und'
 
const LANGCODE_NOT_APPLICABLE = 'zxx'
 
const LANGCODE_DEFAULT = 'x-default'
 
const LANGCODE_SITE_DEFAULT = 'site_default'
 
const STATE_CONFIGURABLE = 1
 
const STATE_LOCKED = 2
 
const STATE_ALL = 3
 
const STATE_SITE_DEFAULT = 4
 
const TYPE_CONTENT = 'language_content'
 
const TYPE_INTERFACE = 'language_interface'
 
const TYPE_URL = 'language_url'
 
const DIRECTION_LTR = 'ltr'
 
const DIRECTION_RTL = 'rtl'
 

Detailed Description

An object containing the information for an interface language.

See Also
::getLanguage()

Constructor & Destructor Documentation

__construct ( array  $values = array())

Constructs a new class instance.

Parameters
array$valuesAn array of property values, keyed by property name, used to construct the language.

References LanguageManager\getStandardLanguageList().

Here is the call graph for this function:

Member Function Documentation

static getDefaultLangcode ( )
staticprotected

Gets the default langcode.

Returns
string The current default langcode.

References Drupal\service().

Here is the call graph for this function:

getDirection ( )

{Gets the text direction (left-to-right or right-to-left).

Returns
string Either self::DIRECTION_LTR or self::DIRECTION_RTL.
}

Implements LanguageInterface.

getId ( )

{Gets the ID (language code).

Returns
string The language code.
}

Implements LanguageInterface.

Referenced by Language\isDefault().

Here is the caller graph for this function:

getName ( )

{Gets the name of the language.

Returns
string The human-readable name of the language (in the language that was used to construct this object).
}

Implements LanguageInterface.

getWeight ( )

{Gets the weight of the language.

Returns
int The weight, used to order languages with larger positive weights sinking items toward the bottom of lists.
}

Implements LanguageInterface.

isDefault ( )

{Returns whether this language is the default language.

Returns
bool Whether the language is the default language.
}

Implements LanguageInterface.

References Language\getId().

Here is the call graph for this function:

isLocked ( )

{Returns whether this language is locked.

Returns
bool Whether the language is locked or not.
}

Implements LanguageInterface.

static sort ( $languages)
static

Sort language objects.

Parameters
\Drupal\Core\Language\LanguageInterface[]$languages The array of language objects keyed by langcode.

References LanguageInterface\getId(), LanguageInterface\getName(), and LanguageInterface\getWeight().

Referenced by ConfigurableLanguageManager\getLanguages(), ConfigurableLanguageManager\getNativeLanguages(), and LanguageUnitTest\testSortArrayOfLanguages().

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

$defaultValues
static
Initial value:
= array(
'id' => 'en',
'name' => 'English',
'direction' => self::DIRECTION_LTR,
'weight' => 0,
'locked' => FALSE,
)

The documentation for this class was generated from the following file: