Commit d479a963 authored by webchick's avatar webchick

Issue #2212411 by LinL, znerol: Code style cleanup of language system.

parent cd94c105
<?php <?php
/**
* @file
* Contains \Drupal\Core\Language\LanguageDefault.
*/
namespace Drupal\Core\Language; namespace Drupal\Core\Language;
/** /**
...@@ -24,10 +29,11 @@ class LanguageDefault { ...@@ -24,10 +29,11 @@ class LanguageDefault {
/** /**
* Constructs the default language object. * Constructs the default language object.
* *
* @param array $default_values * @param array $values
* The properties used to construct the default language.
*/ */
public function __construct(array $default_values) { public function __construct(array $values) {
$this->set(new Language($default_values)); $this->set(new Language($values));
} }
/** /**
......
...@@ -50,7 +50,7 @@ public function __construct(LanguageDefault $default_language) { ...@@ -50,7 +50,7 @@ public function __construct(LanguageDefault $default_language) {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function setTranslation(TranslationInterface $translation) { public function setTranslation(TranslationInterface $translation) {
$this->translation = $translation; $this->translation = $translation;
} }
...@@ -150,7 +150,7 @@ public function getLanguage($langcode) { ...@@ -150,7 +150,7 @@ public function getLanguage($langcode) {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function getLanguageName($langcode) { public function getLanguageName($langcode) {
if ($langcode == Language::LANGCODE_NOT_SPECIFIED) { if ($langcode == Language::LANGCODE_NOT_SPECIFIED) {
return $this->t('None'); return $this->t('None');
} }
...@@ -172,7 +172,7 @@ public function getDefaultLockedLanguages($weight = 0) { ...@@ -172,7 +172,7 @@ public function getDefaultLockedLanguages($weight = 0) {
$locked_language = array( $locked_language = array(
'default' => FALSE, 'default' => FALSE,
'locked' => TRUE, 'locked' => TRUE,
); );
$languages[Language::LANGCODE_NOT_SPECIFIED] = new Language(array( $languages[Language::LANGCODE_NOT_SPECIFIED] = new Language(array(
'id' => Language::LANGCODE_NOT_SPECIFIED, 'id' => Language::LANGCODE_NOT_SPECIFIED,
'name' => $this->t('Not specified'), 'name' => $this->t('Not specified'),
...@@ -214,9 +214,10 @@ public function getLanguageSwitchLinks($type, $path) { ...@@ -214,9 +214,10 @@ public function getLanguageSwitchLinks($type, $path) {
* Some common languages with their English and native names. * Some common languages with their English and native names.
* *
* Language codes are defined by the W3C language tags document for * Language codes are defined by the W3C language tags document for
* interoperability. Language codes typically have a language and optionally, * interoperability. Language codes typically have a language and, optionally,
* a script or regional variant name. See * a script or regional variant name. See:
* http://www.w3.org/International/articles/language-tags/ for more information. * http://www.w3.org/International/articles/language-tags/ for more
* information.
* *
* This list is based on languages available from localize.drupal.org. See * This list is based on languages available from localize.drupal.org. See
* http://localize.drupal.org/issues for information on how to add languages * http://localize.drupal.org/issues for information on how to add languages
...@@ -332,9 +333,9 @@ public static function getStandardLanguageList() { ...@@ -332,9 +333,9 @@ public static function getStandardLanguageList() {
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* This function is a noop since the configuration can not be overridden by * This function is a noop since the configuration cannot be overridden by
* language unless the Language module is enabled. That replaces the default * language unless the Language module is enabled. That replaces the default
* language manger with a configurable language manager. * language manager with a configurable language manager.
* *
* @see \Drupal\language\ConfigurableLanguageManager::setConfigOverrideLanguage() * @see \Drupal\language\ConfigurableLanguageManager::setConfigOverrideLanguage()
*/ */
......
...@@ -17,10 +17,10 @@ interface LanguageManagerInterface { ...@@ -17,10 +17,10 @@ interface LanguageManagerInterface {
/** /**
* Injects the string translation service. * Injects the string translation service.
* *
* @param \use Drupal\Core\StringTranslation\TranslationInterface $translation * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
* The string translation service. * The string translation service.
*/ */
function setTranslation(TranslationInterface $translation); public function setTranslation(TranslationInterface $translation);
/** /**
* Initializes each language type to a language object. * Initializes each language type to a language object.
...@@ -77,17 +77,17 @@ public function reset($type = NULL); ...@@ -77,17 +77,17 @@ public function reset($type = NULL);
public function getDefaultLanguage(); public function getDefaultLanguage();
/** /**
* Returns a list of languages set up on the site. * Returns a list of languages set up on the site.
* *
* @param $flags * @param int $flags
* (optional) Specifies the state of the languages that have to be * (optional) Specifies the state of the languages that have to be returned.
* returned. It can be: Language::STATE_CONFIGURABLE, * It can be: Language::STATE_CONFIGURABLE,
* Language::STATE_LOCKED, Language::STATE_ALL. * Language::STATE_LOCKED, Language::STATE_ALL.
* *
* @return array * @return array
* An associative array of languages, keyed by the language code, ordered * An associative array of languages, keyed by the language code, ordered
* by weight ascending and name ascending. * by weight ascending and name ascending.
*/ */
public function getLanguages($flags = Language::STATE_CONFIGURABLE); public function getLanguages($flags = Language::STATE_CONFIGURABLE);
/** /**
...@@ -110,7 +110,7 @@ public function getLanguage($langcode); ...@@ -110,7 +110,7 @@ public function getLanguage($langcode);
* @return string * @return string
* The printed name of the language. * The printed name of the language.
*/ */
function getLanguageName($langcode); public function getLanguageName($langcode);
/** /**
* Returns a list of the default locked languages. * Returns a list of the default locked languages.
...@@ -158,15 +158,15 @@ public function getFallbackCandidates($langcode = NULL, array $context = array() ...@@ -158,15 +158,15 @@ public function getFallbackCandidates($langcode = NULL, array $context = array()
/** /**
* Returns the language switch links for the given language type. * Returns the language switch links for the given language type.
* *
* @param $type * @param string $type
* The language type. * The language type.
* @param $path * @param string $path
* The internal path the switch links will be relative to. * The internal path the switch links will be relative to.
* *
* @return array * @return array
* A keyed array of links ready to be themed. * A keyed array of links ready to be themed.
*/ */
function getLanguageSwitchLinks($type, $path); public function getLanguageSwitchLinks($type, $path);
/** /**
* Sets the configuration override language. * Sets the configuration override language.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment