W3cubDocs

/Drupal 8

public function LanguageManager::getDefaultLockedLanguages

public LanguageManager::getDefaultLockedLanguages($weight = 0)

Returns a list of the default locked languages.

Parameters

int $weight: (optional) An integer value that is used as the start value for the weights of the locked languages.

Return value

\Drupal\Core\Language\LanguageInterface[] An array of language objects.

Overrides LanguageManagerInterface::getDefaultLockedLanguages

File

core/lib/Drupal/Core/Language/LanguageManager.php, line 174

Class

LanguageManager
Class responsible for providing language support on language-unaware sites.

Namespace

Drupal\Core\Language

Code

public function getDefaultLockedLanguages($weight = 0) {
  $languages = array();

  $locked_language = array(
    'default' => FALSE,
    'locked' => TRUE,
    'direction' => LanguageInterface::DIRECTION_LTR,
  );
  // This is called very early while initializing the language system. Prevent
  // early t() calls by using the TranslatableMarkup.
  $languages[LanguageInterface::LANGCODE_NOT_SPECIFIED] = new Language(array(
    'id' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
    'name' => new TranslatableMarkup('Not specified'),
    'weight' => ++$weight,
  ) + $locked_language);

  $languages[LanguageInterface::LANGCODE_NOT_APPLICABLE] = new Language(array(
    'id' => LanguageInterface::LANGCODE_NOT_APPLICABLE,
    'name' => new TranslatableMarkup('Not applicable'),
    'weight' => ++$weight,
  ) + $locked_language);

  return $languages;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Language!LanguageManager.php/function/LanguageManager::getDefaultLockedLanguages/8.1.x