Commit d479a963 authored by webchick's avatar webchick

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

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