diff -u b/core/includes/bootstrap.inc b/core/includes/bootstrap.inc --- b/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -1893,7 +1893,7 @@ * @see \Drupal\Core\Language\LanguageManager * * @param string $type - * The type of language object needed, e.g. Language::TYPE_INTERFACE. + * The type of language object needed, e.g. LanguageInterface::TYPE_INTERFACE. * * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. * Use \Drupal::languageManager()->getCurrentLanguage(). @@ -1907,8 +1907,8 @@ * * @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. + * It can be: LanguageInterface::STATE_CONFIGURABLE, + * LanguageInterface::STATE_LOCKED, or LanguageInterface::STATE_ALL. * * @return \Drupal\Core\Language\LanguageInterface[] * An associative array of languages, keyed by the language code, ordered by diff -u b/core/includes/common.inc b/core/includes/common.inc --- b/core/includes/common.inc +++ b/core/includes/common.inc @@ -19,7 +19,7 @@ use Drupal\Component\Utility\UrlHelper; use Drupal\Component\Utility\Xss; use Drupal\Core\Cache\Cache; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Site\Settings; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; @@ -564,7 +564,7 @@ * Arbitrary elements may be added using the $args associative array. */ function format_rss_channel($title, $link, $description, $items, $langcode = NULL, $args = array()) { - $langcode = $langcode ? $langcode : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->getId(); + $langcode = $langcode ? $langcode : \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId(); $output = "\n"; $output .= ' ' . String::checkPlain($title) . "\n"; @@ -1968,7 +1968,7 @@ 'currentPath' => $current_path, 'currentPathIsAdmin' => $current_path_is_admin, 'isFront' => drupal_is_front_page(), - 'currentLanguage' => \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_URL)->getId(), + 'currentLanguage' => \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_URL)->getId(), ); if (!empty($current_query)) { ksort($current_query); diff -u b/core/includes/form.inc b/core/includes/form.inc --- b/core/includes/form.inc +++ b/core/includes/form.inc @@ -11,7 +11,6 @@ use Drupal\Component\Utility\UrlHelper; use Drupal\Component\Utility\Xss; use Drupal\Core\Database\Database; -use Drupal\Core\Language\Language; use Drupal\Core\Render\Element; use Drupal\Core\Template\Attribute; use Drupal\Core\Utility\Color; diff -u b/core/includes/theme.inc b/core/includes/theme.inc --- b/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -13,7 +13,6 @@ use Drupal\Component\Utility\Xss; use Drupal\Core\Config\Config; use Drupal\Core\Config\StorageException; -use Drupal\Core\Language\Language; use Drupal\Core\Extension\Extension; use Drupal\Core\Extension\ExtensionNameLengthException; use Drupal\Core\Template\Attribute; diff -u b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php --- b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php +++ b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php @@ -7,7 +7,6 @@ namespace Drupal\Core\Datetime; use Drupal\Component\Datetime\DateTimePlus; -use Drupal\Core\Language\Language; /** * Extends DateTimePlus(). diff -u b/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php --- b/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -10,7 +10,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Entity\Plugin\DataType\EntityReference; use Drupal\Core\Entity\TypedData\EntityDataDefinition; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\TypedData\TypedDataInterface; @@ -38,7 +38,7 @@ * The plain data values of the contained fields. * * This always holds the original, unchanged values of the entity. The values - * are keyed by language code, whereas Language::LANGCODE_DEFAULT is used for + * are keyed by language code, whereas LanguageInterface::LANGCODE_DEFAULT is used for * values in default language. * * @todo: Add methods for getting original fields and for determining @@ -80,7 +80,7 @@ * * @var string */ - protected $activeLangcode = Language::LANGCODE_DEFAULT; + protected $activeLangcode = LanguageInterface::LANGCODE_DEFAULT; /** * Local cache for the default language code. @@ -141,22 +141,22 @@ public function __construct(array $values, $entity_type, $bundle = FALSE, $translations = array()) { $this->entityTypeId = $entity_type; $this->entityKeys['bundle'] = $bundle ? $bundle : $this->entityTypeId; - $this->languages = $this->languageManager()->getLanguages(Language::STATE_ALL); + $this->languages = $this->languageManager()->getLanguages(LanguageInterface::STATE_ALL); foreach ($values as $key => $value) { // If the key matches an existing property set the value to the property // to set properties like isDefaultRevision. // @todo: Should this be converted somehow? - if (property_exists($this, $key) && isset($value[Language::LANGCODE_DEFAULT])) { - $this->$key = $value[Language::LANGCODE_DEFAULT]; + if (property_exists($this, $key) && isset($value[LanguageInterface::LANGCODE_DEFAULT])) { + $this->$key = $value[LanguageInterface::LANGCODE_DEFAULT]; } } $this->values = $values; foreach ($this->getEntityType()->getKeys() as $key => $field_name) { if (isset($this->values[$field_name])) { - if (is_array($this->values[$field_name]) && isset($this->values[$field_name][Language::LANGCODE_DEFAULT])) { - $this->entityKeys[$key] = $this->values[$field_name][Language::LANGCODE_DEFAULT]; + if (is_array($this->values[$field_name]) && isset($this->values[$field_name][LanguageInterface::LANGCODE_DEFAULT])) { + $this->entityKeys[$key] = $this->values[$field_name][LanguageInterface::LANGCODE_DEFAULT]; } } } @@ -164,11 +164,11 @@ // Initialize translations. Ensure we have at least an entry for the default // language. $data = array('status' => static::TRANSLATION_EXISTING); - $this->translations[Language::LANGCODE_DEFAULT] = $data; + $this->translations[LanguageInterface::LANGCODE_DEFAULT] = $data; $this->setDefaultLangcode(); if ($translations) { foreach ($translations as $langcode) { - if ($langcode != $this->defaultLangcode && $langcode != Language::LANGCODE_DEFAULT) { + if ($langcode != $this->defaultLangcode && $langcode != LanguageInterface::LANGCODE_DEFAULT) { $this->translations[$langcode] = $data; } } @@ -427,14 +427,14 @@ throw new \InvalidArgumentException('Field ' . String::checkPlain($name) . ' is unknown.'); } // Non-translatable fields are always stored with - // Language::LANGCODE_DEFAULT as key. + // LanguageInterface::LANGCODE_DEFAULT as key. - $default = $langcode == Language::LANGCODE_DEFAULT; + $default = $langcode == LanguageInterface::LANGCODE_DEFAULT; if (!$default && !$definition->isTranslatable()) { - if (!isset($this->fields[$name][Language::LANGCODE_DEFAULT])) { - $this->fields[$name][Language::LANGCODE_DEFAULT] = $this->getTranslatedField($name, Language::LANGCODE_DEFAULT); + if (!isset($this->fields[$name][LanguageInterface::LANGCODE_DEFAULT])) { + $this->fields[$name][LanguageInterface::LANGCODE_DEFAULT] = $this->getTranslatedField($name, LanguageInterface::LANGCODE_DEFAULT); } - $this->fields[$name][$langcode] = &$this->fields[$name][Language::LANGCODE_DEFAULT]; + $this->fields[$name][$langcode] = &$this->fields[$name][LanguageInterface::LANGCODE_DEFAULT]; } else { $value = NULL; @@ -446,7 +446,7 @@ // $this->defaultLangcode might not be set if we are initializing the // default language code cache, in which case there is no valid // langcode to assign. - $field_langcode = isset($this->defaultLangcode) ? $this->defaultLangcode : Language::LANGCODE_NOT_SPECIFIED; + $field_langcode = isset($this->defaultLangcode) ? $this->defaultLangcode : LanguageInterface::LANGCODE_NOT_SPECIFIED; } else { $field_langcode = $langcode; @@ -554,9 +554,9 @@ */ public function language() { $language = NULL; - if ($this->activeLangcode != Language::LANGCODE_DEFAULT) { + if ($this->activeLangcode != LanguageInterface::LANGCODE_DEFAULT) { if (!isset($this->languages[$this->activeLangcode])) { - $this->languages += $this->languageManager()->getLanguages(Language::STATE_ALL); + $this->languages += $this->languageManager()->getLanguages(LanguageInterface::STATE_ALL); } $language = $this->languages[$this->activeLangcode]; } @@ -576,12 +576,12 @@ } if (empty($this->defaultLangcode)) { // Make sure we return a proper language object. - $this->defaultLangcode = Language::LANGCODE_NOT_SPECIFIED; + $this->defaultLangcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; } // This needs to be initialized manually as it is skipped when instantiating // the language field object to avoid infinite recursion. if (!empty($this->fields['langcode'])) { - $this->fields['langcode'][Language::LANGCODE_DEFAULT]->setLangcode($this->defaultLangcode); + $this->fields['langcode'][LanguageInterface::LANGCODE_DEFAULT]->setLangcode($this->defaultLangcode); } } @@ -593,8 +593,8 @@ */ protected function updateFieldLangcodes($langcode) { foreach ($this->fields as $name => $items) { - if (!empty($items[Language::LANGCODE_DEFAULT])) { - $items[Language::LANGCODE_DEFAULT]->setLangcode($langcode); + if (!empty($items[LanguageInterface::LANGCODE_DEFAULT])) { + $items[LanguageInterface::LANGCODE_DEFAULT]->setLangcode($langcode); } } } @@ -630,8 +630,8 @@ public function getTranslation($langcode) { // Ensure we always use the default language code when dealing with the // original entity language. - if ($langcode != Language::LANGCODE_DEFAULT && $langcode == $this->defaultLangcode) { - $langcode = Language::LANGCODE_DEFAULT; + if ($langcode != LanguageInterface::LANGCODE_DEFAULT && $langcode == $this->defaultLangcode) { + $langcode = LanguageInterface::LANGCODE_DEFAULT; } // Populate entity translation object cache so it will be available for all @@ -674,7 +674,7 @@ * {@inheritdoc} */ public function getUntranslated() { - return $this->getTranslation(Language::LANGCODE_DEFAULT); + return $this->getTranslation(LanguageInterface::LANGCODE_DEFAULT); } /** @@ -721,7 +721,7 @@ */ public function hasTranslation($langcode) { if ($langcode == $this->defaultLangcode) { - $langcode = Language::LANGCODE_DEFAULT; + $langcode = LanguageInterface::LANGCODE_DEFAULT; } return !empty($this->translations[$langcode]['status']); } @@ -766,7 +766,7 @@ * {@inheritdoc} */ public function removeTranslation($langcode) { - if (isset($this->translations[$langcode]) && $langcode != Language::LANGCODE_DEFAULT && $langcode != $this->defaultLangcode) { + if (isset($this->translations[$langcode]) && $langcode != LanguageInterface::LANGCODE_DEFAULT && $langcode != $this->defaultLangcode) { foreach ($this->getFieldDefinitions() as $name => $definition) { if ($definition->isTranslatable()) { unset($this->values[$name][$langcode]); @@ -785,7 +785,7 @@ * {@inheritdoc} */ public function initTranslation($langcode) { - if ($langcode != Language::LANGCODE_DEFAULT && $langcode != $this->defaultLangcode) { + if ($langcode != LanguageInterface::LANGCODE_DEFAULT && $langcode != $this->defaultLangcode) { $this->translations[$langcode]['status'] = static::TRANSLATION_EXISTING; } } @@ -795,7 +795,7 @@ */ public function getTranslationLanguages($include_default = TRUE) { $translations = array_filter($this->translations, function($translation) { return $translation['status']; }); - unset($translations[Language::LANGCODE_DEFAULT]); + unset($translations[LanguageInterface::LANGCODE_DEFAULT]); if ($include_default) { $translations[$this->defaultLangcode] = TRUE; @@ -957,7 +957,7 @@ // we retain just the original value, as references will be recreated // later as needed. if (!$definitions[$name]->isTranslatable() && count($values) > 1) { - $values = array_intersect_key($values, array(Language::LANGCODE_DEFAULT => TRUE)); + $values = array_intersect_key($values, array(LanguageInterface::LANGCODE_DEFAULT => TRUE)); } foreach ($values as $langcode => $items) { $this->fields[$name][$langcode] = clone $items; diff -u b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php --- b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php @@ -10,7 +10,7 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Entity\Query\QueryInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\field\FieldInfo; use Drupal\field\FieldConfigUpdateForbiddenException; use Drupal\field\FieldConfigInterface; @@ -165,12 +165,12 @@ // that store several properties). if ($field_name = strstr($name, '__', TRUE)) { $property_name = substr($name, strpos($name, '__') + 2); - $entities[$id][$field_name][Language::LANGCODE_DEFAULT][$property_name] = $value; + $entities[$id][$field_name][LanguageInterface::LANGCODE_DEFAULT][$property_name] = $value; } else { // Handle columns named directly after the field (e.g if the field // type only stores one property). - $entities[$id][$name][Language::LANGCODE_DEFAULT] = $value; + $entities[$id][$name][LanguageInterface::LANGCODE_DEFAULT] = $value; } } // If we have no multilingual values we can instantiate entity objecs @@ -211,7 +211,7 @@ // Get the revision IDs. $revision_ids = array(); foreach ($entities as $values) { - $revision_ids[] = is_object($values) ? $values->getRevisionId() : $values[$this->revisionKey][Language::LANGCODE_DEFAULT]; + $revision_ids[] = is_object($values) ? $values->getRevisionId() : $values[$this->revisionKey][LanguageInterface::LANGCODE_DEFAULT]; } $query->condition($this->revisionKey, $revision_ids); } @@ -230,8 +230,8 @@ $id = $values[$this->idKey]; // Field values in default language are stored with - // Language::LANGCODE_DEFAULT as key. - $langcode = empty($values['default_langcode']) ? $values['langcode'] : Language::LANGCODE_DEFAULT; + // LanguageInterface::LANGCODE_DEFAULT as key. + $langcode = empty($values['default_langcode']) ? $values['langcode'] : LanguageInterface::LANGCODE_DEFAULT; $translations[$id][$langcode] = TRUE; foreach (array_keys($field_definitions) as $field_name) { @@ -257,7 +257,7 @@ } foreach ($entities as $id => $values) { - $bundle = $this->bundleKey ? $values[$this->bundleKey][Language::LANGCODE_DEFAULT] : FALSE; + $bundle = $this->bundleKey ? $values[$this->bundleKey][LanguageInterface::LANGCODE_DEFAULT] : FALSE; // Turn the record into an entity class. $entities[$id] = new $this->entityClass($values, $this->entityTypeId, $bundle, array_keys($translations[$id])); } @@ -725,7 +725,7 @@ } // Load field data. - $langcodes = array_keys(language_list(Language::STATE_ALL)); + $langcodes = array_keys(language_list(LanguageInterface::STATE_ALL)); foreach ($fields as $field_name => $field) { $table = $load_current ? static::_fieldTableName($field) : static::_fieldRevisionTableName($field); diff -u b/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php --- b/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -17,7 +17,7 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageManager; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Plugin\Discovery\AlterDecorator; use Drupal\Core\Plugin\Discovery\CacheDecorator; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; @@ -505,7 +505,7 @@ } } // Not prepared, try to load from cache. - $cid = 'entity_field_storage_definitions:' . $entity_type_id . ':' . $this->languageManager->getCurrentLanguage()->id; + $cid = 'entity_field_storage_definitions:' . $entity_type_id . ':' . $this->languageManager->getCurrentLanguage()->getId(); if ($cache = $this->cache->get($cid)) { $field_storage_definitions = $cache->data; } @@ -655,7 +655,7 @@ if ($entity instanceof TranslatableInterface) { if (empty($langcode)) { - $langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->getId(); + $langcode = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId(); } // Retrieve language fallback candidates to perform the entity language @@ -666,7 +666,7 @@ // Ensure the default language has the proper language code. $default_language = $entity->getUntranslated()->language(); - $candidates[$default_language->getId()] = Language::LANGCODE_DEFAULT; + $candidates[$default_language->getId()] = LanguageInterface::LANGCODE_DEFAULT; // Return the most fitting entity translation. foreach ($candidates as $candidate) { @@ -720,7 +720,7 @@ protected function getAllDisplayModesByEntityType($display_type) { if (!isset($this->displayModeInfo[$display_type])) { $key = 'entity_' . $display_type . '_info'; - $langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_INTERFACE)->getId(); + $langcode = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_INTERFACE)->getId(); if ($cache = $this->cache->get("$key:$langcode")) { $this->displayModeInfo[$display_type] = $cache->data; } diff -u b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php --- b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -13,7 +13,7 @@ use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemListInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\TypedData\TranslatableInterface; use Drupal\Core\Render\Element; @@ -214,7 +214,7 @@ */ public function viewMultiple(array $entities = array(), $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->getId(); + $langcode = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId(); } $build_list = array( diff -u b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php --- b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -7,7 +7,6 @@ namespace Drupal\Core\EventSubscriber; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManager; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; diff -u b/core/lib/Drupal/Core/Language/LanguageManager.php b/core/lib/Drupal/Core/Language/LanguageManager.php --- b/core/lib/Drupal/Core/Language/LanguageManager.php +++ b/core/lib/Drupal/Core/Language/LanguageManager.php @@ -80,13 +80,13 @@ * {@inheritdoc} */ public function getLanguageTypes() { - return array(Language::TYPE_INTERFACE, Language::TYPE_CONTENT, Language::TYPE_URL); + return array(LanguageInterface::TYPE_INTERFACE, LanguageInterface::TYPE_CONTENT, LanguageInterface::TYPE_URL); } /** * {@inheritdoc} */ - public function getCurrentLanguage($type = Language::TYPE_INTERFACE) { + public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) { return $this->getDefaultLanguage(); } @@ -107,7 +107,7 @@ /** * {@inheritdoc} */ - public function getLanguages($flags = Language::STATE_CONFIGURABLE) { + public function getLanguages($flags = LanguageInterface::STATE_CONFIGURABLE) { // Initialize master language list. if (!isset($this->languages)) { // No language module, so use the default language only. @@ -123,7 +123,7 @@ $filtered_languages = array(); // Add the site's default language if flagged as allowed value. - if ($flags & Language::STATE_SITE_DEFAULT) { + if ($flags & LanguageInterface::STATE_SITE_DEFAULT) { $default = isset($default) ? $default : $this->getDefaultLanguage(); // Rename the default language. $default->setName($this->t("Site's default language (@lang_name)", array('@lang_name' => $default->getName()))); @@ -131,7 +131,7 @@ } foreach ($this->languages as $id => $language) { - if (($language->isLocked() && ($flags & Language::STATE_LOCKED)) || (!$language->isLocked() && ($flags & Language::STATE_CONFIGURABLE))) { + if (($language->isLocked() && ($flags & LanguageInterface::STATE_LOCKED)) || (!$language->isLocked() && ($flags & LanguageInterface::STATE_CONFIGURABLE))) { $filtered_languages[$id] = $language; } } @@ -143,7 +143,7 @@ * {@inheritdoc} */ public function getLanguage($langcode) { - $languages = $this->getLanguages(Language::STATE_ALL); + $languages = $this->getLanguages(LanguageInterface::STATE_ALL); return isset($languages[$langcode]) ? $languages[$langcode] : NULL; } @@ -151,7 +151,7 @@ * {@inheritdoc} */ public function getLanguageName($langcode) { - if ($langcode == Language::LANGCODE_NOT_SPECIFIED) { + if ($langcode == LanguageInterface::LANGCODE_NOT_SPECIFIED) { return $this->t('None'); } if ($language = $this->getLanguage($langcode)) { @@ -173,14 +173,14 @@ 'default' => FALSE, 'locked' => TRUE, ); - $languages[Language::LANGCODE_NOT_SPECIFIED] = new Language(array( - 'id' => Language::LANGCODE_NOT_SPECIFIED, + $languages[LanguageInterface::LANGCODE_NOT_SPECIFIED] = new Language(array( + 'id' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'name' => $this->t('Not specified'), 'weight' => ++$weight, ) + $locked_language); - $languages[Language::LANGCODE_NOT_APPLICABLE] = new Language(array( - 'id' => Language::LANGCODE_NOT_APPLICABLE, + $languages[LanguageInterface::LANGCODE_NOT_APPLICABLE] = new Language(array( + 'id' => LanguageInterface::LANGCODE_NOT_APPLICABLE, 'name' => $this->t('Not applicable'), 'weight' => ++$weight, ) + $locked_language); @@ -200,7 +200,7 @@ * {@inheritdoc} */ public function getFallbackCandidates($langcode = NULL, array $context = array()) { - return array(Language::LANGCODE_DEFAULT); + return array(LanguageInterface::LANGCODE_DEFAULT); } /** @@ -235,7 +235,7 @@ return array( 'af' => array('Afrikaans', 'Afrikaans'), 'am' => array('Amharic', 'አማርኛ'), - 'ar' => array('Arabic', /* Left-to-right marker "‭" */ 'العربية', Language::DIRECTION_RTL), + 'ar' => array('Arabic', /* Left-to-right marker "‭" */ 'العربية', LanguageInterface::DIRECTION_RTL), 'ast' => array('Asturian', 'Asturianu'), 'az' => array('Azerbaijani', 'Azərbaycanca'), 'be' => array('Belarusian', 'Беларуская'), @@ -255,7 +255,7 @@ 'es' => array('Spanish', 'Español'), 'et' => array('Estonian', 'Eesti'), 'eu' => array('Basque', 'Euskera'), - 'fa' => array('Persian, Farsi', /* Left-to-right marker "‭" */ 'فارسی', Language::DIRECTION_RTL), + 'fa' => array('Persian, Farsi', /* Left-to-right marker "‭" */ 'فارسی', LanguageInterface::DIRECTION_RTL), 'fi' => array('Finnish', 'Suomi'), 'fil' => array('Filipino', 'Filipino'), 'fo' => array('Faeroese', 'Føroyskt'), @@ -266,7 +266,7 @@ 'gl' => array('Galician', 'Galego'), 'gsw-berne' => array('Swiss German', 'Schwyzerdütsch'), 'gu' => array('Gujarati', 'ગુજરાતી'), - 'he' => array('Hebrew', /* Left-to-right marker "‭" */ 'עברית', Language::DIRECTION_RTL), + 'he' => array('Hebrew', /* Left-to-right marker "‭" */ 'עברית', LanguageInterface::DIRECTION_RTL), 'hi' => array('Hindi', 'हिन्दी'), 'hr' => array('Croatian', 'Hrvatski'), 'ht' => array('Haitian Creole', 'Kreyòl ayisyen'), @@ -322,7 +322,7 @@ 'tyv' => array('Tuvan', 'Тыва дыл'), 'ug' => array('Uyghur', 'Уйғур'), 'uk' => array('Ukrainian', 'Українська'), - 'ur' => array('Urdu', /* Left-to-right marker "‭" */ 'اردو', Language::DIRECTION_RTL), + 'ur' => array('Urdu', /* Left-to-right marker "‭" */ 'اردو', LanguageInterface::DIRECTION_RTL), 'vi' => array('Vietnamese', 'Tiếng Việt'), 'xx-lolspeak' => array('Lolspeak', 'Lolspeak'), 'zh-hans' => array('Chinese, Simplified', '简体中文'), diff -u b/core/lib/Drupal/Core/Language/LanguageManagerInterface.php b/core/lib/Drupal/Core/Language/LanguageManagerInterface.php --- b/core/lib/Drupal/Core/Language/LanguageManagerInterface.php +++ b/core/lib/Drupal/Core/Language/LanguageManagerInterface.php @@ -48,19 +48,19 @@ * * @param string $type * (optional) The language type, e.g. the interface or the content language. - * Defaults to \Drupal\Core\Language\Language::TYPE_INTERFACE. + * Defaults to \Drupal\Core\Language\LanguageInterface::TYPE_INTERFACE. * * @return \Drupal\Core\Language\LanguageInterface * A language object for the given type. */ - public function getCurrentLanguage($type = Language::TYPE_INTERFACE); + public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE); /** * Resets the given language type or all types if none specified. * * @param string|null $type * (optional) The language type to reset as a string, e.g., - * Language::TYPE_INTERFACE, or NULL to reset all language types. Defaults + * LanguageInterface::TYPE_INTERFACE, or NULL to reset all language types. Defaults * to NULL. * * @return \Drupal\Core\Language\LanguageManagerInterface @@ -81,13 +81,13 @@ * * @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. + * It can be: LanguageInterface::STATE_CONFIGURABLE, + * LanguageInterface::STATE_LOCKED, LanguageInterface::STATE_ALL. * * @return \Drupal\Core\Language\LanguageInterface[] * An associative array of languages, keyed by the language code. */ - public function getLanguages($flags = Language::STATE_CONFIGURABLE); + public function getLanguages($flags = LanguageInterface::STATE_CONFIGURABLE); /** * Returns a language object from the given language code. diff -u b/core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php b/core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php --- b/core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php +++ b/core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php @@ -7,7 +7,6 @@ namespace Drupal\Core\Page; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManager; /** diff -u b/core/lib/Drupal/Core/Path/AliasManager.php b/core/lib/Drupal/Core/Path/AliasManager.php --- b/core/lib/Drupal/Core/Path/AliasManager.php +++ b/core/lib/Drupal/Core/Path/AliasManager.php @@ -7,7 +7,7 @@ namespace Drupal\Core\Path; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManager; class AliasManager implements AliasManagerInterface { @@ -95,7 +95,7 @@ // language. If we used a language different from the one conveyed by the // requested URL, we might end up being unable to check if there is a path // alias matching the URL path. - $path_language = $path_language ?: $this->languageManager->getCurrentLanguage(Language::TYPE_URL)->getId(); + $path_language = $path_language ?: $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_URL)->getId(); // Lookup the path alias first. if (!empty($path) && $source = $this->lookupPathSource($path, $path_language)) { $path = $source; @@ -112,7 +112,7 @@ // language. If we used a language different from the one conveyed by the // requested URL, we might end up being unable to check if there is a path // alias matching the URL path. - $path_language = $path_language ?: $this->languageManager->getCurrentLanguage(Language::TYPE_URL)->getId(); + $path_language = $path_language ?: $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_URL)->getId(); $result = $path; if (!empty($path) && $alias = $this->lookupPathAlias($path, $path_language)) { $result = $alias; diff -u b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php --- b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -16,7 +16,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageManagerInterface; -use Drupal\Core\Language\Language; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; use Drupal\Core\Plugin\Factory\ContainerFactory; diff -u b/core/lib/Drupal/Core/TypedData/TranslatableInterface.php b/core/lib/Drupal/Core/TypedData/TranslatableInterface.php --- b/core/lib/Drupal/Core/TypedData/TranslatableInterface.php +++ b/core/lib/Drupal/Core/TypedData/TranslatableInterface.php @@ -42,7 +42,7 @@ * instantiated. * * @param $langcode - * The language code of the translation to get or Language::LANGCODE_DEFAULT + * The language code of the translation to get or LanguageInterface::LANGCODE_DEFAULT * to get the data in default language. * * @return \Drupal\Core\TypedData\TypedDataInterface diff -u b/core/lib/Drupal/Core/Validation/DrupalTranslator.php b/core/lib/Drupal/Core/Validation/DrupalTranslator.php --- b/core/lib/Drupal/Core/Validation/DrupalTranslator.php +++ b/core/lib/Drupal/Core/Validation/DrupalTranslator.php @@ -7,7 +7,6 @@ namespace Drupal\Core\Validation; -use Drupal\Core\Language\Language; use Symfony\Component\Translation\TranslatorInterface; /** diff -u b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockForm.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockForm.php --- b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockForm.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockForm.php @@ -11,7 +11,7 @@ use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManager; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -110,7 +110,7 @@ '#title' => $this->t('Language'), '#type' => 'language_select', '#default_value' => $block->getUntranslated()->language()->id, - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#access' => isset($language_configuration['language_show']) && $language_configuration['language_show'], ); diff -u b/core/modules/block/lib/Drupal/block/BlockForm.php b/core/modules/block/lib/Drupal/block/BlockForm.php --- b/core/modules/block/lib/Drupal/block/BlockForm.php +++ b/core/modules/block/lib/Drupal/block/BlockForm.php @@ -10,7 +10,7 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\language\ConfigurableLanguageManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -157,7 +157,7 @@ $language_types = $this->languageManager->getLanguageTypes(); // Fetch languages. - $languages = $this->languageManager->getLanguages(Language::STATE_ALL); + $languages = $this->languageManager->getLanguages(LanguageInterface::STATE_ALL); $langcodes_options = array(); foreach ($languages as $language) { // @todo $language->name is not wrapped with t(), it should be replaced diff -u b/core/modules/book/book.module b/core/modules/book/book.module --- b/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -11,7 +11,7 @@ use Drupal\Core\Render\Element; use Drupal\node\NodeInterface; use Drupal\node\NodeTypeInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Template\Attribute; @@ -488,7 +488,7 @@ $variables['title'] = String::checkPlain($variables['title']); $variables['base_url'] = $base_url; $variables['language'] = $language_interface; - $variables['language_rtl'] = ($language_interface->getDirection() == Language::DIRECTION_RTL); + $variables['language_rtl'] = ($language_interface->getDirection() == LanguageInterface::DIRECTION_RTL); $variables['head'] = drupal_get_html_head(); // HTML element attributes. diff -u b/core/modules/ckeditor/ckeditor.admin.inc b/core/modules/ckeditor/ckeditor.admin.inc --- b/core/modules/ckeditor/ckeditor.admin.inc +++ b/core/modules/ckeditor/ckeditor.admin.inc @@ -5,7 +5,6 @@ * Callbacks and theming for the CKEditor toolbar configuration UI. */ -use Drupal\Core\Language\Language; use Drupal\Core\Template\Attribute; /** diff -u b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php --- b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php @@ -10,7 +10,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\ckeditor\CKEditorPluginManager; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManager; use Drupal\Core\Render\Element; use Drupal\editor\Plugin\EditorBase; diff -u b/core/modules/comment/lib/Drupal/comment/CommentForm.php b/core/modules/comment/lib/Drupal/comment/CommentForm.php --- b/core/modules/comment/lib/Drupal/comment/CommentForm.php +++ b/core/modules/comment/lib/Drupal/comment/CommentForm.php @@ -14,7 +14,7 @@ use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\field\FieldInfo; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -74,7 +74,7 @@ // Make the comment inherit the current content language unless specifically // set. if ($comment->isNew()) { - $language_content = \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); + $language_content = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); $comment->langcode->value = $language_content->getId(); } diff -u b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php --- b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php @@ -8,7 +8,6 @@ namespace Drupal\comment\Tests; use Drupal\Component\Utility\Xss; -use Drupal\Core\Language\Language; /** * Tests comment token replacement in strings. diff -u b/core/modules/contact/lib/Drupal/contact/MessageForm.php b/core/modules/contact/lib/Drupal/contact/MessageForm.php --- b/core/modules/contact/lib/Drupal/contact/MessageForm.php +++ b/core/modules/contact/lib/Drupal/contact/MessageForm.php @@ -11,7 +11,6 @@ use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Flood\FloodInterface; -use Drupal\Core\Language\Language; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff -u b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php --- b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php @@ -8,7 +8,7 @@ namespace Drupal\content_translation\Access; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Routing\Access\AccessInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\Routing\Route; @@ -56,7 +56,7 @@ $source = language_load($request->attributes->get('source')); $target = language_load($request->attributes->get('target')); $source = !empty($source) ? $source : $entity->language(); - $target = !empty($target) ? $target : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); + $target = !empty($target) ? $target : \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); return ($source->getId() != $target->getId() && isset($languages[$source->getId()]) && isset($languages[$target->getId()]) @@ -67,7 +67,7 @@ case 'update': case 'delete': $language = language_load($request->attributes->get('language')); - $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); + $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); return isset($languages[$language->getId()]) && $language->getId() != $entity->getUntranslated()->language()->id && isset($translations[$language->getId()]) diff -u b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationHandler.php b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationHandler.php --- b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationHandler.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationHandler.php @@ -9,7 +9,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element; /** @@ -129,7 +129,7 @@ '#submit' => array(array($this, 'entityFormSourceChange')), ), ); - foreach (language_list(Language::STATE_CONFIGURABLE) as $language) { + foreach (language_list(LanguageInterface::STATE_CONFIGURABLE) as $language) { if (isset($translations[$language->getId()])) { $form['source_langcode']['source']['#options'][$language->getId()] = $language->getName(); } @@ -142,7 +142,7 @@ $language_widget = isset($form['langcode']) && $form['langcode']['#type'] == 'language_select'; if ($language_widget && $has_translations) { $form['langcode']['#options'] = array(); - foreach (language_list(Language::STATE_CONFIGURABLE) as $language) { + foreach (language_list(LanguageInterface::STATE_CONFIGURABLE) as $language) { if (empty($translations[$language->getId()]) || $language->getId() == $entity_langcode) { $form['langcode']['#options'][$language->getId()] = $language->getName(); } diff -u b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php --- b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php @@ -17,7 +17,7 @@ use Drupal\Core\Entity\ContentEntityDatabaseStorage; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FormatterPluginManager; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManager; use Drupal\Core\Session\AccountInterface; use Drupal\views\Views; @@ -290,12 +290,12 @@ $field = $field_definition; if ($field->isTranslatable() && !empty($this->view->display_handler->options['field_langcode_add_to_query'])) { $column = $this->tableAlias . '.langcode'; - // By the same reason as field_language the field might be Language::LANGCODE_NOT_SPECIFIED in reality so allow it as well. + // By the same reason as field_language the field might be LanguageInterface::LANGCODE_NOT_SPECIFIED in reality so allow it as well. // @see this::field_langcode() $default_langcode = language_default()->getId(); $langcode = str_replace( array('***CURRENT_LANGUAGE***', '***DEFAULT_LANGUAGE***'), - array($this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT), $default_langcode), + array($this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT), $default_langcode), $this->view->display_handler->options['field_langcode'] ); $placeholder = $this->placeholder(); @@ -901,12 +901,12 @@ $default_langcode = language_default()->getId(); $langcode = str_replace( array('***CURRENT_LANGUAGE***', '***DEFAULT_LANGUAGE***'), - array($this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT), $default_langcode), + array($this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT), $default_langcode), $this->view->display_handler->options['field_language'] ); // Give the Entity Field API a chance to fallback to a different language - // (or Language::LANGCODE_NOT_SPECIFIED), in case the field has no data + // (or LanguageInterface::LANGCODE_NOT_SPECIFIED), in case the field has no data // for the selected language. FieldItemListInterface::view() does this as // well, but since the returned language code is used before calling it, // the fallback needs to happen explicitly. @@ -915,7 +915,7 @@ return $langcode; } else { - return Language::LANGCODE_NOT_SPECIFIED; + return LanguageInterface::LANGCODE_NOT_SPECIFIED; } } diff -u b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php --- b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; - /** * Tests the file token replacement in strings. */ diff -u b/core/modules/filter/filter.module b/core/modules/filter/filter.module --- b/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -9,7 +9,6 @@ use Drupal\Component\Utility\String; use Drupal\Component\Utility\Xss; use Drupal\Core\Cache\Cache; -use Drupal\Core\Language\Language; use Drupal\Core\Render\Element; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Template\Attribute; diff -u b/core/modules/language/language.module b/core/modules/language/language.module --- b/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -142,7 +142,7 @@ $type['language_select']['#process'] = array_merge($type['language_select']['#process'], array('language_process_language_select', 'form_process_select', 'ajax_process_form')); $type['language_select']['#theme'] = 'select'; $type['language_select']['#theme_wrappers'] = array_merge($type['language_select']['#theme_wrappers'], array('form_element')); - $type['language_select']['#languages'] = Language::STATE_CONFIGURABLE; + $type['language_select']['#languages'] = LanguageInterface::STATE_CONFIGURABLE; $type['language_select']['#multiple'] = FALSE; } } @@ -496,18 +496,18 @@ */ function language_language_types_info() { return array( - Language::TYPE_INTERFACE => array( + LanguageInterface::TYPE_INTERFACE => array( 'name' => t('User interface text'), 'description' => t('Order of language detection methods for user interface text. If a translation of user interface text is available in the detected language, it will be displayed.'), 'locked' => TRUE, ), - Language::TYPE_CONTENT => array( + LanguageInterface::TYPE_CONTENT => array( 'name' => t('Content'), 'description' => t('Order of language detection methods for content. If a version of content is available in the detected language, it will be displayed.'), 'fixed' => array(LanguageNegotiationUI::METHOD_ID), 'locked' => TRUE, ), - Language::TYPE_URL => array( + LanguageInterface::TYPE_URL => array( 'fixed' => array(LanguageNegotiationUrl::METHOD_ID, LanguageNegotiationUrlFallback::METHOD_ID), 'locked' => TRUE, ), diff -u b/core/modules/language/lib/Drupal/language/ConfigurableLanguageManager.php b/core/modules/language/lib/Drupal/language/ConfigurableLanguageManager.php --- b/core/modules/language/lib/Drupal/language/ConfigurableLanguageManager.php +++ b/core/modules/language/lib/Drupal/language/ConfigurableLanguageManager.php @@ -136,7 +136,7 @@ * {@inheritdoc} */ public function isMultilingual() { - return count($this->getLanguages(Language::STATE_CONFIGURABLE)) > 1; + return count($this->getLanguages(LanguageInterface::STATE_CONFIGURABLE)) > 1; } /** @@ -198,7 +198,7 @@ /** * {@inheritdoc} */ - public function getCurrentLanguage($type = Language::TYPE_INTERFACE) { + public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) { if (!isset($this->negotiatedLanguages[$type])) { // Ensure we have a valid value for this language type. $this->negotiatedLanguages[$type] = $this->getDefaultLanguage(); @@ -215,8 +215,8 @@ // original strings which can be translated by calling them again // afterwards. This can happen for instance while parsing negotiation // method definitions. - elseif ($type == Language::TYPE_INTERFACE) { - return new Language(array('id' => Language::LANGCODE_SYSTEM)); + elseif ($type == LanguageInterface::TYPE_INTERFACE) { + return new Language(array('id' => LanguageInterface::LANGCODE_SYSTEM)); } } } @@ -270,7 +270,7 @@ /** * {@inheritdoc} */ - public function getLanguages($flags = Language::STATE_CONFIGURABLE) { + public function getLanguages($flags = LanguageInterface::STATE_CONFIGURABLE) { if (!isset($this->languages)) { // Prepopulate the language list with the default language to keep things // working even if we have no configuration. @@ -298,7 +298,7 @@ $this->languages += $this->getDefaultLockedLanguages($weight); // Sort the language list by weight then title. - Language::sort($this->languages); + LanguageInterface::sort($this->languages); } return parent::getLanguages($flags); @@ -311,14 +311,14 @@ $max_weight = 0; // Get maximum weight to update the system languages to keep them on bottom. - foreach ($this->getLanguages(Language::STATE_CONFIGURABLE) as $language) { + foreach ($this->getLanguages(LanguageInterface::STATE_CONFIGURABLE) as $language) { if (!$language->isLocked() && $language->getWeight() > $max_weight) { $max_weight = $language->getWeight(); } } // Loop locked languages to maintain the existing order. - $locked_languages = $this->getLanguages(Language::STATE_LOCKED); + $locked_languages = $this->getLanguages(LanguageInterface::STATE_LOCKED); $config_ids = array_map(function(LanguageInterface $language) { return 'language.entity.' . $language->getId(); }, $locked_languages); foreach ($this->configFactory->loadMultiple($config_ids) as $config_id => $config) { // Update system languages weight. @@ -333,10 +333,10 @@ */ public function getFallbackCandidates($langcode = NULL, array $context = array()) { if ($this->isMultilingual()) { - // Get languages ordered by weight, add Language::LANGCODE_NOT_SPECIFIED + // Get languages ordered by weight, add LanguageInterface::LANGCODE_NOT_SPECIFIED // at the end. $candidates = array_keys($this->getLanguages()); - $candidates[] = Language::LANGCODE_NOT_SPECIFIED; + $candidates[] = LanguageInterface::LANGCODE_NOT_SPECIFIED; $candidates = array_combine($candidates, $candidates); // The first candidate should always be the desired language if specified. diff -u b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUI.php b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUI.php --- b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUI.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUI.php @@ -15,7 +15,7 @@ * * @Plugin( * id = Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI::METHOD_ID, - * types = {Drupal\Core\Language\Language::TYPE_CONTENT}, + * types = {Drupal\Core\Language\LanguageInterface::TYPE_CONTENT}, * weight = 9, * name = @Translation("Interface"), * description = @Translation("Use the detected interface language.") diff -u b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php --- b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php @@ -7,7 +7,7 @@ namespace Drupal\language\Plugin\LanguageNegotiation; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\PathProcessor\InboundPathProcessorInterface; use Drupal\Core\PathProcessor\OutboundPathProcessorInterface; use Drupal\language\LanguageNegotiationMethodBase; @@ -19,7 +19,7 @@ * * @Plugin( * id = \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl::METHOD_ID, - * types = {\Drupal\Core\Language\Language::TYPE_INTERFACE, \Drupal\Core\Language\Language::TYPE_CONTENT, \Drupal\Core\Language\Language::TYPE_URL}, + * types = {\Drupal\Core\Language\LanguageInterface::TYPE_INTERFACE, \Drupal\Core\Language\LanguageInterface::TYPE_CONTENT, \Drupal\Core\Language\LanguageInterface::TYPE_URL}, * weight = -8, * name = @Translation("URL"), * description = @Translation("Language from the URL (Path prefix or domain)."), @@ -106,7 +106,7 @@ // Search prefix within enabled languages. foreach ($this->languageManager->getLanguages() as $language) { - if (isset($config['prefixes'][$language->id]) && $config['prefixes'][$language->id] == $prefix) { + if (isset($config['prefixes'][$language->getId()]) && $config['prefixes'][$language->getId()] == $prefix) { // Rebuild $path with the language removed. $path = implode('/', $parts); break; @@ -129,7 +129,7 @@ $languages = array_flip(array_keys($this->languageManager->getLanguages())); // Language can be passed as an option, or we go for current URL language. if (!isset($options['language'])) { - $language_url = $this->languageManager->getCurrentLanguage(Language::TYPE_URL); + $language_url = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_URL); $options['language'] = $language_url; } // We allow only enabled languages here. diff -u b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrlFallback.php b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrlFallback.php --- b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrlFallback.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrlFallback.php @@ -34,7 +34,7 @@ * * @Plugin( * id = Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrlFallback::METHOD_ID, - * types = {Drupal\Core\Language\Language::TYPE_URL}, + * types = {Drupal\Core\Language\LanguageInterface::TYPE_URL}, * weight = 8, * name = @Translation("URL fallback"), * description = @Translation("Use an already detected language for URLs if none is found.") diff -u b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php --- b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php @@ -94,7 +94,7 @@ $old_default->setDefault(FALSE); language_save($old_default); $new_default = \Drupal::languageManager()->getLanguage('cc'); - $new_default->setDefault(TRUE)); + $new_default->setDefault(TRUE); language_save($new_default); language_save_default_configuration('custom_type', 'custom_bundle', array('langcode' => 'site_default', 'language_show' => TRUE)); $langcode = language_get_default_langcode('custom_type', 'custom_bundle'); @@ -104,7 +104,7 @@ $language_entity = entity_load('language_entity', $old_default->getId()); $this->assertFalse($language_entity->get('default'), 'The en language entity is not flagged as the default language.'); $language_entity = entity_load('language_entity', 'cc'); - // Check calling the Drupal\language\Entity\Language::isDefault() method + // Check calling the Drupal\language\Entity\LanguageInterface::isDefault() method // directly. $this->assertTrue($language_entity->isDefault(), 'The cc language entity is flagged as the default language.'); diff -u b/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php --- b/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php @@ -8,6 +8,7 @@ namespace Drupal\language\Tests; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests the language fallback behavior. @@ -41,7 +42,7 @@ */ public function testCandidates() { $language_list = $this->languageManager->getLanguages(); - $expected = array_keys($language_list + array(Language::LANGCODE_NOT_SPECIFIED => NULL)); + $expected = array_keys($language_list + array(LanguageInterface::LANGCODE_NOT_SPECIFIED => NULL)); // Check that language fallback candidates by default are all the available // languages sorted by weight. @@ -57,8 +58,8 @@ // Check that candidates are alterable for specific operations. $this->state->set('language_test.fallback_alter.candidates', FALSE); $this->state->set('language_test.fallback_operation_alter.candidates', TRUE); - $expected[] = Language::LANGCODE_NOT_SPECIFIED; - $expected[] = Language::LANGCODE_NOT_APPLICABLE; + $expected[] = LanguageInterface::LANGCODE_NOT_SPECIFIED; + $expected[] = LanguageInterface::LANGCODE_NOT_APPLICABLE; $candidates = $this->languageManager->getFallbackCandidates(NULL, array('operation' => 'test')); $this->assertEqual(array_values($candidates), $expected, 'Language fallback candidates are alterable for specific operations.'); @@ -70,7 +71,7 @@ } } $candidates = $this->languageManager->getFallbackCandidates(); - $this->assertEqual(array_values($candidates), array(Language::LANGCODE_DEFAULT), 'Language fallback is not applied when the Language module is not enabled.'); + $this->assertEqual(array_values($candidates), array(LanguageInterface::LANGCODE_DEFAULT), 'Language fallback is not applied when the Language module is not enabled.'); } } diff -u b/core/modules/language/tests/language_test/language_test.module b/core/modules/language/tests/language_test/language_test.module --- b/core/modules/language/tests/language_test/language_test.module +++ b/core/modules/language/tests/language_test/language_test.module @@ -5,7 +5,7 @@ * Mock module for language layer tests. */ -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI; /** @@ -41,13 +41,13 @@ */ function language_test_language_types_info_alter(array &$language_types) { if (\Drupal::state()->get('language_test.content_language_type')) { - $language_types[Language::TYPE_CONTENT]['locked'] = FALSE; - unset($language_types[Language::TYPE_CONTENT]['fixed']); - // By default languages are not configurable. Make Language::TYPE_CONTENT + $language_types[LanguageInterface::TYPE_CONTENT]['locked'] = FALSE; + unset($language_types[LanguageInterface::TYPE_CONTENT]['fixed']); + // By default languages are not configurable. Make LanguageInterface::TYPE_CONTENT // configurable. $configurable = \Drupal::config('language.types')->get('configurable'); - if (!in_array(Language::TYPE_CONTENT, $configurable)) { - $configurable[] = Language::TYPE_CONTENT; + if (!in_array(LanguageInterface::TYPE_CONTENT, $configurable)) { + $configurable[] = LanguageInterface::TYPE_CONTENT; \Drupal::config('language.types')->set('configurable', $configurable)->save(); } } @@ -80,7 +80,7 @@ */ function language_test_language_fallback_candidates_alter(array &$candidates, array $context) { if (Drupal::state()->get('language_test.fallback_alter.candidates')) { - unset($candidates[Language::LANGCODE_NOT_SPECIFIED]); + unset($candidates[LanguageInterface::LANGCODE_NOT_SPECIFIED]); } } @@ -89,7 +89,7 @@ */ function language_test_language_fallback_candidates_test_alter(array &$candidates, array $context) { if (Drupal::state()->get('language_test.fallback_operation_alter.candidates')) { - $langcode = Language::LANGCODE_NOT_APPLICABLE; + $langcode = LanguageInterface::LANGCODE_NOT_APPLICABLE; $candidates[$langcode] = $langcode; } } diff -u b/core/modules/locale/lib/Drupal/locale/Form/ExportForm.php b/core/modules/locale/lib/Drupal/locale/Form/ExportForm.php --- b/core/modules/locale/lib/Drupal/locale/Form/ExportForm.php +++ b/core/modules/locale/lib/Drupal/locale/Form/ExportForm.php @@ -9,7 +9,7 @@ use Drupal\Component\Gettext\PoStreamWriter; use Drupal\Core\Form\FormBase; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\locale\PoDatabaseReader; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -69,7 +69,7 @@ if (empty($language_options)) { $form['langcode'] = array( '#type' => 'value', - '#value' => Language::LANGCODE_SYSTEM, + '#value' => LanguageInterface::LANGCODE_SYSTEM, ); $form['langcode_text'] = array( '#type' => 'item', @@ -84,7 +84,7 @@ '#options' => $language_options, '#default_value' => $language_default->getId(), '#empty_option' => $this->t('Source text only, no translations'), - '#empty_value' => Language::LANGCODE_SYSTEM, + '#empty_value' => LanguageInterface::LANGCODE_SYSTEM, ); $form['content_options'] = array( '#type' => 'details', @@ -93,7 +93,7 @@ '#tree' => TRUE, '#states' => array( 'invisible' => array( - ':input[name="langcode"]' => array('value' => Language::LANGCODE_SYSTEM), + ':input[name="langcode"]' => array('value' => LanguageInterface::LANGCODE_SYSTEM), ), ), ); @@ -129,7 +129,7 @@ */ public function submitForm(array &$form, array &$form_state) { // If template is required, language code is not given. - if ($form_state['values']['langcode'] != Language::LANGCODE_SYSTEM) { + if ($form_state['values']['langcode'] != LanguageInterface::LANGCODE_SYSTEM) { $language = $this->languageManager->getLanguage($form_state['values']['langcode']); } else { diff -u b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php --- b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php +++ b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php @@ -8,7 +8,6 @@ namespace Drupal\locale\Form; use Drupal\Core\Form\FormBase; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManager; use Drupal\locale\StringStorageInterface; use Drupal\Core\State\StateInterface; diff -u b/core/modules/locale/locale.module b/core/modules/locale/locale.module --- b/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -14,7 +14,7 @@ use Drupal\Component\Utility\UrlHelper; use Drupal\Component\Utility\Xss; use Drupal\Core\Cache\Cache; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\Entity\Language as LanguageEntity; use Drupal\Component\Utility\Crypt; @@ -627,7 +627,7 @@ $language_interface = \Drupal::languageManager()->getCurrentLanguage(); $settings['jquery']['ui']['datepicker'] = array( - 'isRTL' => $language_interface->getDirection() == Language::DIRECTION_RTL, + 'isRTL' => $language_interface->getDirection() == LanguageInterface::DIRECTION_RTL, 'firstDay' => \Drupal::config('system.date')->get('first_day'), ); $library['js'][] = array( @@ -802,7 +802,7 @@ function locale_preprocess_node(&$variables) { /** @var \Drupal\node\NodeInterface $node */ $node = $variables['node']; - if ($node->language()->getId() != Language::LANGCODE_NOT_SPECIFIED) { + if ($node->language()->getId() != LanguageInterface::LANGCODE_NOT_SPECIFIED) { $language_interface = \Drupal::languageManager()->getCurrentLanguage(); $node_language = $node->language(); diff -u b/core/modules/node/lib/Drupal/node/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Node.php --- b/core/modules/node/lib/Drupal/node/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Entity/Node.php @@ -11,7 +11,7 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldDefinition; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\node\NodeInterface; use Drupal\user\UserInterface; @@ -162,7 +162,7 @@ // Load languages the node exists in. $node_translations = $this->getTranslationLanguages(); // Load the language from content negotiation. - $content_negotiation_langcode = \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->getId(); + $content_negotiation_langcode = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId(); // If there is a translation available, use it. if (isset($node_translations[$content_negotiation_langcode])) { $langcode = $content_negotiation_langcode; diff -u b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php --- b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php @@ -13,7 +13,7 @@ use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\State\StateInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Access\AccessibleInterface; use Drupal\Core\Database\Query\Condition; @@ -452,7 +452,7 @@ // Add languages. $language_options = array(); - $language_list = \Drupal::languageManager()->getLanguages(Language::STATE_ALL); + $language_list = \Drupal::languageManager()->getLanguages(LanguageInterface::STATE_ALL); foreach ($language_list as $langcode => $language) { // Make locked languages appear special in the list. $language_options[$langcode] = $language->locked ? t('- @name -', array('@name' => $language->name)) : $language->name; diff -u b/core/modules/node/node.module b/core/modules/node/node.module --- b/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -9,7 +9,6 @@ */ use Drupal\Component\Utility\Xss; -use Drupal\Core\Language\Language; use Drupal\Core\Render\Element; use Drupal\Core\Url; use Symfony\Component\HttpFoundation\Response; @@ -1072,7 +1071,7 @@ */ function node_feed($nids = FALSE, $channel = array()) { global $base_url; - $language_content = \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); + $language_content = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); $rss_config = \Drupal::config('system.rss'); if ($nids === FALSE) { diff -u b/core/modules/search/search.pages.inc b/core/modules/search/search.pages.inc --- b/core/modules/search/search.pages.inc +++ b/core/modules/search/search.pages.inc @@ -5,8 +5,6 @@ * User page callbacks for the Search module. */ -use Drupal\Core\Language\Language; - /** * Implements hook_theme_suggestions_HOOK(). */ @@ -36,7 +34,7 @@ $result = $variables['result']; $variables['url'] = check_url($result['link']); $variables['title'] = check_plain($result['title']); - if (isset($result['language']) && $result['language'] != $language_interface->getId() && $result['language'] != Language::LANGCODE_NOT_SPECIFIED) { + if (isset($result['language']) && $result['language'] != $language_interface->getId() && $result['language'] != LanguageInterface::LANGCODE_NOT_SPECIFIED) { $variables['title_attributes']['lang'] = $result['language']; $variables['content_attributes']['lang'] = $result['language']; } diff -u b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php --- b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php +++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php @@ -7,7 +7,6 @@ namespace Drupal\statistics\Tests; -use Drupal\Core\Language\Language; /** * Tests statistics token replacement in strings. diff -u b/core/modules/system/language.api.php b/core/modules/system/language.api.php --- b/core/modules/system/language.api.php +++ b/core/modules/system/language.api.php @@ -27,7 +27,7 @@ function hook_language_switch_links_alter(array &$links, $type, $path) { $language_interface = \Drupal::languageManager()->getCurrentLanguage(); - if ($type == \Drupal\Core\Language\Language::TYPE_CONTENT && isset($links[$language_interface->id])) { + if ($type == \Drupal\Core\Language\LanguageInterface::TYPE_CONTENT && isset($links[$language_interface->id])) { foreach ($links[$language_interface->getId()] as $link) { $link['attributes']['class'][] = 'active-language'; } diff -u b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php @@ -113,7 +113,7 @@ 'predefined_langcode' => 'custom', 'langcode' => self::LANGCODE, 'name' => self::LANGCODE, - 'direction' => Language::DIRECTION_LTR, + 'direction' => LanguageInterface::DIRECTION_LTR, ); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); diff -u b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php @@ -58,7 +58,7 @@ $web_user = $this->drupalCreateUser(array('create page content', 'edit own page content', 'administer content types')); $this->drupalLogin($web_user); - // Create a node with language Language::LANGCODE_NOT_SPECIFIED. + // Create a node with language LanguageInterface::LANGCODE_NOT_SPECIFIED. $edit = array(); $edit['title[0][value]'] = $this->randomName(8); $edit['body[0][value]'] = $this->randomName(16); @@ -84,7 +84,7 @@ // Enable language selector. $this->drupalGet('admin/structure/types/manage/page'); - $edit = array('language_configuration[language_show]' => TRUE, 'language_configuration[langcode]' => Language::LANGCODE_NOT_SPECIFIED); + $edit = array('language_configuration[language_show]' => TRUE, 'language_configuration[langcode]' => LanguageInterface::LANGCODE_NOT_SPECIFIED); $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type')); $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), 'Basic page content type has been updated.'); diff -u b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php @@ -7,7 +7,7 @@ namespace Drupal\system\Tests\Entity; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\entity_test\Entity\EntityTestMulRev; /** @@ -44,15 +44,15 @@ 'name' => 'test', 'user_id' => $this->container->get('current_user')->id(), )); - $this->assertEqual($entity->language()->id, Language::LANGCODE_NOT_SPECIFIED, format_string('%entity_type: Entity language not specified.', array('%entity_type' => $entity_type))); + $this->assertEqual($entity->language()->id, LanguageInterface::LANGCODE_NOT_SPECIFIED, format_string('%entity_type: Entity language not specified.', array('%entity_type' => $entity_type))); $this->assertFalse($entity->getTranslationLanguages(FALSE), format_string('%entity_type: No translations are available', array('%entity_type' => $entity_type))); // Set the value in default language. $entity->set($this->field_name, array(0 => array('value' => 'default value'))); // Get the value. - $field = $entity->getTranslation(Language::LANGCODE_DEFAULT)->get($this->field_name); + $field = $entity->getTranslation(LanguageInterface::LANGCODE_DEFAULT)->get($this->field_name); $this->assertEqual($field->value, 'default value', format_string('%entity_type: Untranslated value retrieved.', array('%entity_type' => $entity_type))); - $this->assertEqual($field->getLangcode(), Language::LANGCODE_NOT_SPECIFIED, format_string('%entity_type: Field object has the expected langcode.', array('%entity_type' => $entity_type))); + $this->assertEqual($field->getLangcode(), LanguageInterface::LANGCODE_NOT_SPECIFIED, format_string('%entity_type: Field object has the expected langcode.', array('%entity_type' => $entity_type))); // Set the value in a certain language. As the entity is not // language-specific it should use the default language and so ignore the @@ -65,7 +65,7 @@ // language-specific entity. $field = $entity->getTranslation($this->langcodes[1])->get($this->field_name); $this->assertEqual($field->value, 'default value2', format_string('%entity_type: Untranslated value retrieved.', array('%entity_type' => $entity_type))); - $this->assertEqual($field->getLangcode(), Language::LANGCODE_NOT_SPECIFIED, format_string('%entity_type: Field object has the expected langcode.', array('%entity_type' => $entity_type))); + $this->assertEqual($field->getLangcode(), LanguageInterface::LANGCODE_NOT_SPECIFIED, format_string('%entity_type: Field object has the expected langcode.', array('%entity_type' => $entity_type))); // Now, make the entity language-specific by assigning a language and test // translating it. @@ -153,11 +153,11 @@ $entity->save(); $entity = entity_load($entity_type, $entity->id()); $default_langcode = $entity->language()->id; - $this->assertEqual($default_langcode, Language::LANGCODE_NOT_SPECIFIED, format_string('%entity_type: Entity created as language neutral.', array('%entity_type' => $entity_type))); - $field = $entity->getTranslation(Language::LANGCODE_DEFAULT)->get('name'); + $this->assertEqual($default_langcode, LanguageInterface::LANGCODE_NOT_SPECIFIED, format_string('%entity_type: Entity created as language neutral.', array('%entity_type' => $entity_type))); + $field = $entity->getTranslation(LanguageInterface::LANGCODE_DEFAULT)->get('name'); $this->assertEqual($name, $field->value, format_string('%entity_type: The entity name has been correctly stored as language neutral.', array('%entity_type' => $entity_type))); $this->assertEqual($default_langcode, $field->getLangcode(), format_string('%entity_type: The field object has the expect langcode.', array('%entity_type' => $entity_type))); - $this->assertEqual($uid, $entity->getTranslation(Language::LANGCODE_DEFAULT)->get('user_id')->target_id, format_string('%entity_type: The entity author has been correctly stored as language neutral.', array('%entity_type' => $entity_type))); + $this->assertEqual($uid, $entity->getTranslation(LanguageInterface::LANGCODE_DEFAULT)->get('user_id')->target_id, format_string('%entity_type: The entity author has been correctly stored as language neutral.', array('%entity_type' => $entity_type))); $field = $entity->getTranslation($langcode)->get('name'); $this->assertEqual($name, $field->value, format_string('%entity_type: The entity name defaults to neutral language.', array('%entity_type' => $entity_type))); $this->assertEqual($default_langcode, $field->getLangcode(), format_string('%entity_type: The field object has the expect langcode.', array('%entity_type' => $entity_type))); @@ -179,11 +179,11 @@ $this->assertEqual($default_langcode, $field->getLangcode(), format_string('%entity_type: The field object has the expect langcode.', array('%entity_type' => $entity_type))); $this->assertEqual($uid, $entity->getTranslation($langcode)->get('user_id')->target_id, format_string('%entity_type: The entity author has been correctly stored as a language-aware property.', array('%entity_type' => $entity_type))); // Translatable properties on a translatable entity should use default - // language if Language::LANGCODE_NOT_SPECIFIED is passed. - $field = $entity->getTranslation(Language::LANGCODE_NOT_SPECIFIED)->get('name'); + // language if LanguageInterface::LANGCODE_NOT_SPECIFIED is passed. + $field = $entity->getTranslation(LanguageInterface::LANGCODE_NOT_SPECIFIED)->get('name'); $this->assertEqual($name, $field->value, format_string('%entity_type: The entity name defaults to the default language.', array('%entity_type' => $entity_type))); $this->assertEqual($default_langcode, $field->getLangcode(), format_string('%entity_type: The field object has the expect langcode.', array('%entity_type' => $entity_type))); - $this->assertEqual($uid, $entity->getTranslation(Language::LANGCODE_NOT_SPECIFIED)->get('user_id')->target_id, format_string('%entity_type: The entity author defaults to the default language.', array('%entity_type' => $entity_type))); + $this->assertEqual($uid, $entity->getTranslation(LanguageInterface::LANGCODE_NOT_SPECIFIED)->get('user_id')->target_id, format_string('%entity_type: The entity author defaults to the default language.', array('%entity_type' => $entity_type))); $field = $entity->get('name'); $this->assertEqual($name, $field->value, format_string('%entity_type: The entity name can be retrieved without specifying a language.', array('%entity_type' => $entity_type))); $this->assertEqual($default_langcode, $field->getLangcode(), format_string('%entity_type: The field object has the expect langcode.', array('%entity_type' => $entity_type))); @@ -309,7 +309,7 @@ $entity->langcode->value = $default_langcode; $translation = $entity->getTranslation($default_langcode); $this->assertEqual($entity, $translation, 'The translation object corresponding to the default language (explicit) is the entity object itself.'); - $translation = $entity->getTranslation(Language::LANGCODE_DEFAULT); + $translation = $entity->getTranslation(LanguageInterface::LANGCODE_DEFAULT); $this->assertEqual($entity, $translation, 'The translation object corresponding to the default language (implicit) is the entity object itself.'); // Create a translation and verify that the translation object and the @@ -377,7 +377,7 @@ // Check that removing an invalid translation causes an exception to be // thrown. - foreach (array($default_langcode, Language::LANGCODE_DEFAULT, $this->randomName()) as $invalid_langcode) { + foreach (array($default_langcode, LanguageInterface::LANGCODE_DEFAULT, $this->randomName()) as $invalid_langcode) { $message = format_string('Removing an invalid translation (@langcode) causes an exception to be thrown.', array('@langcode' => $invalid_langcode)); try { $entity->removeTranslation($invalid_langcode); @@ -448,7 +448,7 @@ * Tests language fallback applied to field and entity translations. */ function testLanguageFallback() { - $current_langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->getId(); + $current_langcode = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId(); $this->langcodes[] = $current_langcode; $values = array(); diff -u b/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php b/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php @@ -7,7 +7,6 @@ namespace Drupal\system\Tests\Mail; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; /** diff -u b/core/modules/system/system.api.php b/core/modules/system/system.api.php --- b/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -307,7 +307,7 @@ $language_interface = \Drupal::languageManager()->getCurrentLanguage(); $settings['jquery']['ui']['datepicker'] = array( - 'isRTL' => $language_interface->getDirection() == Language::DIRECTION_RTL, + 'isRTL' => $language_interface->getDirection() == LanguageInterface::DIRECTION_RTL, 'firstDay' => \Drupal::config('system.date')->get('first_day'), ); $library['js'][] = array( diff -u b/core/modules/system/system.module b/core/modules/system/system.module --- b/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -6,7 +6,7 @@ */ use Drupal\Core\Cache\Cache; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Extension\Extension; use Drupal\Core\Extension\ExtensionDiscovery; use Drupal\block\BlockPluginInterface; @@ -496,7 +496,7 @@ ); $types['language_select'] = array( '#input' => TRUE, - '#default_value' => Language::LANGCODE_NOT_SPECIFIED, + '#default_value' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); $types['weight'] = array( '#input' => TRUE, @@ -956,7 +956,7 @@ array( 'path' => current_path(), 'front' => drupal_is_front_page(), - 'language' => \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\Language::TYPE_URL)->getId(), + 'language' => \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\LanguageInterface::TYPE_URL)->getId(), 'query' => \Drupal::service('request')->query->all(), ) ); diff -u b/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/CachedMockBlockManager.php b/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/CachedMockBlockManager.php --- b/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/CachedMockBlockManager.php +++ b/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/CachedMockBlockManager.php @@ -7,7 +7,6 @@ namespace Drupal\plugin_test\Plugin; -use Drupal\Core\Language\Language; use Drupal\Core\Plugin\Discovery\CacheDecorator; /** diff -u b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php --- b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php @@ -9,7 +9,6 @@ use Drupal\Component\Utility\Xss; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; use Drupal\Component\Utility\String; /** diff -u b/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module --- b/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -6,7 +6,6 @@ */ use Drupal\Core\Cache\Cache; -use Drupal\Core\Language\Language; use Drupal\Core\Render\Element; use Drupal\Core\Template\Attribute; use Drupal\Component\Utility\Crypt; diff -u b/core/modules/user/lib/Drupal/user/AccountForm.php b/core/modules/user/lib/Drupal/user/AccountForm.php --- b/core/modules/user/lib/Drupal/user/AccountForm.php +++ b/core/modules/user/lib/Drupal/user/AccountForm.php @@ -10,7 +10,7 @@ use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\Query\QueryFactory; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\language\ConfigurableLanguageManagerInterface; use Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUserAdmin; @@ -241,7 +241,7 @@ $user_language_enabled = FALSE; if ($this->languageManager instanceof ConfigurableLanguageManagerInterface) { $negotiator = $this->languageManager->getNegotiator(); - $user_language_enabled = $negotiator && $negotiator->isNegotiationMethodEnabled(LanguageNegotiationUser::METHOD_ID, Language::TYPE_INTERFACE); + $user_language_enabled = $negotiator && $negotiator->isNegotiationMethodEnabled(LanguageNegotiationUser::METHOD_ID, LanguageInterface::TYPE_INTERFACE); } $form['language'] = array( '#type' => $this->languageManager->isMultilingual() ? 'details' : 'container', @@ -255,7 +255,7 @@ $form['language']['preferred_langcode'] = array( '#type' => 'language_select', '#title' => $this->t('Site language'), - '#languages' => Language::STATE_CONFIGURABLE, + '#languages' => LanguageInterface::STATE_CONFIGURABLE, '#default_value' => $user_preferred_langcode, '#description' => $user_language_enabled ? $this->t("This account's preferred language for e-mails and site presentation.") : $this->t("This account's preferred language for e-mails."), ); @@ -270,7 +270,7 @@ $form['language']['preferred_admin_langcode'] = array( '#type' => 'language_select', '#title' => $this->t('Administration pages language'), - '#languages' => Language::STATE_CONFIGURABLE, + '#languages' => LanguageInterface::STATE_CONFIGURABLE, '#default_value' => $user_preferred_admin_langcode, '#access' => $show_admin_language, ); diff -u b/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php b/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php --- b/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php +++ b/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php @@ -9,7 +9,6 @@ use Drupal\Core\Field\Plugin\Field\FieldType\EmailItem; use Drupal\Core\Form\FormBase; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManager; use Drupal\user\UserStorageInterface; use Symfony\Component\HttpFoundation\Request; diff -u b/core/modules/user/user.install b/core/modules/user/user.install --- b/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -5,7 +5,6 @@ * Install, update and uninstall functions for the user module. */ -use Drupal\Core\Language\Language; use Drupal\field\Field; /** diff -u b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php --- b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php @@ -8,7 +8,6 @@ namespace Drupal\views\Plugin\views\cache; use Drupal\Core\Cache\Cache; -use Drupal\Core\Language\Language; use Drupal\views\Plugin\views\PluginBase; use Drupal\Core\Database\Query\Select; diff -u b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php --- b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -9,7 +9,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Cache\Cache; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Theme\Registry; use Drupal\views\Plugin\views\area\AreaPluginBase; @@ -1243,7 +1243,7 @@ $languages = array( '***CURRENT_LANGUAGE***' => t("Current user's language"), '***DEFAULT_LANGUAGE***' => t("Default site language"), - Language::LANGCODE_NOT_SPECIFIED => t('Language neutral'), + LanguageInterface::LANGCODE_NOT_SPECIFIED => t('Language neutral'), ); if (\Drupal::moduleHandler()->moduleExists('language')) { $languages = array_merge($languages, language_list()); @@ -1617,7 +1617,7 @@ $languages = array( '***CURRENT_LANGUAGE***' => t("Current user's language"), '***DEFAULT_LANGUAGE***' => t("Default site language"), - Language::LANGCODE_NOT_SPECIFIED => t('Language neutral'), + LanguageInterface::LANGCODE_NOT_SPECIFIED => t('Language neutral'), ); $languages = array_merge($languages, views_language_list()); diff -u b/core/modules/views/views.api.php b/core/modules/views/views.api.php --- b/core/modules/views/views.api.php +++ b/core/modules/views/views.api.php @@ -341,7 +341,7 @@ return array( '***CURRENT_VERSION***' => \Drupal::VERSION, '***CURRENT_TIME***' => REQUEST_TIME, - '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\Language::TYPE_CONTENT)->getId(), + '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\LanguageInterface::TYPE_CONTENT)->getId(), '***DEFAULT_LANGUAGE***' => \Drupal::languageManager()->getDefaultLanguage()->getId(), ); } diff -u b/core/modules/views/views.module b/core/modules/views/views.module --- b/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -12,7 +12,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Cache\Cache; use Drupal\Core\Database\Query\AlterableInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element; use Drupal\views\Plugin\Derivative\ViewsLocalTask; use Drupal\Core\Template\AttributeArray; @@ -506,15 +506,15 @@ * array. * @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. + * It can be: LanguageInterface::STATE_CONFIGURABLE, LanguageInterface::STATE_LOCKED, + * LanguageInterface::STATE_ALL. * * @return array * An array of language names (or $field) keyed by the langcode. * * @see locale_language_list() */ -function views_language_list($field = 'name', $flags = Language::STATE_ALL) { +function views_language_list($field = 'name', $flags = LanguageInterface::STATE_ALL) { $languages = \Drupal::languageManager()->getLanguages($flags); $list = array(); foreach ($languages as $language) { diff -u b/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc --- b/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -7,7 +7,6 @@ use Drupal\Component\Utility\String; use Drupal\Component\Utility\Xss; -use Drupal\Core\Language\Language; use Drupal\Core\Template\Attribute; use Drupal\views\Form\ViewsForm; use Drupal\views\ViewExecutable; diff -u b/core/modules/views/views.views_execution.inc b/core/modules/views/views.views_execution.inc --- b/core/modules/views/views.views_execution.inc +++ b/core/modules/views/views.views_execution.inc @@ -5,7 +5,7 @@ * Provides views runtime hooks for views.module. */ -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\views\ViewExecutable; /** @@ -17,7 +17,7 @@ return array( '***CURRENT_VERSION***' => \Drupal::VERSION, '***CURRENT_TIME***' => REQUEST_TIME, - '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->getId(), + '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId(), '***DEFAULT_LANGUAGE***' => \Drupal::languageManager()->getDefaultLanguage()->getId(), ); } diff -u b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php --- b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php @@ -17,6 +17,7 @@ use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Tests\UnitTestCase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -111,12 +112,16 @@ $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface'); + $language = $this->getMock('\Drupal\Core\Language\LanguageInterface'); + $language->expects($this->any()) + ->method('getId') + ->will($this->returnValue('en')); $this->languageManager = $this->getMockBuilder('Drupal\Core\Language\LanguageManager') ->disableOriginalConstructor() ->getMock(); $this->languageManager->expects($this->any()) ->method('getCurrentLanguage') - ->will($this->returnValue((object) array('id' => 'en'))); + ->will($this->returnValue($language)); $this->translationManager = $this->getStringTranslationStub(); @@ -885,13 +890,17 @@ $entity->expects($this->exactly(2)) ->method('getUntranslated') ->will($this->returnValue($entity)); + $language = $this->getMock('\Drupal\Core\Language\LanguageInterface'); + $language->expects($this->any()) + ->method('getId') + ->will($this->returnValue('en')); $entity->expects($this->exactly(2)) ->method('language') - ->will($this->returnValue((object) array('id' => 'en'))); + ->will($this->returnValue($language)); $entity->expects($this->exactly(2)) ->method('hasTranslation') ->will($this->returnValueMap(array( - array(Language::LANGCODE_DEFAULT, FALSE), + array(LanguageInterface::LANGCODE_DEFAULT, FALSE), array('custom_langcode', TRUE), ))); diff -u b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php --- b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php +++ b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php @@ -7,7 +7,7 @@ namespace Drupal\Tests\Core\PathProcessor; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\PathProcessor\PathProcessorAlias; use Drupal\Core\PathProcessor\PathProcessorDecode; use Drupal\Core\PathProcessor\PathProcessorFront; @@ -85,7 +85,7 @@ ->will($this->returnValue($this->languages)); $language_manager->expects($this->any()) ->method('getLanguageTypes') - ->will($this->returnValue(array(Language::TYPE_INTERFACE))); + ->will($this->returnValue(array(LanguageInterface::TYPE_INTERFACE))); $language_manager->expects($this->any()) ->method('getNegotiationMethods') ->will($this->returnValue($method_definitions)); only in patch2: unchanged: --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -8,7 +8,6 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; /** * Resets the cached information about entity types. only in patch2: unchanged: --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -7,7 +7,6 @@ use Drupal\Component\Utility\String; use Drupal\Core\Cache\Cache; -use Drupal\Core\Language\Language; use Drupal\Core\Render\Element; use Drupal\Core\Template\Attribute; use Symfony\Cmf\Component\Routing\RouteObjectInterface; only in patch2: unchanged: --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -800,14 +800,14 @@ function update_replace_permissions($replace) { * * @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. + * It can be: LanguageInterface::STATE_CONFIGURABLE, LanguageInterface::STATE_LOCKED, + * LanguageInterface::STATE_ALL. * * @return array * An associative array of languages, keyed by the language code, ordered by * weight ascending and name ascending. */ -function update_language_list($flags = Language::STATE_CONFIGURABLE) { +function update_language_list($flags = LanguageInterface::STATE_CONFIGURABLE) { $languages = &drupal_static(__FUNCTION__); @@ -837,7 +837,7 @@ function update_language_list($flags = Language::STATE_CONFIGURABLE) { 'weight' => $info['weight'], )); } - Language::sort($languages); + LanguageInterface::sort($languages); } else { // No language module, so use the default language only. @@ -853,7 +853,7 @@ function update_language_list($flags = Language::STATE_CONFIGURABLE) { $filtered_languages = array(); // Add the site's default language if flagged as allowed value. - if ($flags & Language::STATE_SITE_DEFAULT) { + if ($flags & LanguageInterface::STATE_SITE_DEFAULT) { $default = isset($default) ? $default : \Drupal::languageManager()->getDefaultLanguage(); // Rename the default language. $default->name = t("Site's default language (@lang_name)", array('@lang_name' => $default->name)); @@ -861,7 +861,7 @@ function update_language_list($flags = Language::STATE_CONFIGURABLE) { } foreach ($languages as $langcode => $language) { - if (($language->locked && !($flags & Language::STATE_LOCKED)) || (!$language->locked && !($flags & Language::STATE_CONFIGURABLE))) { + if (($language->locked && !($flags & LanguageInterface::STATE_LOCKED)) || (!$language->locked && !($flags & LanguageInterface::STATE_CONFIGURABLE))) { continue; } $filtered_languages[$langcode] = $language; only in patch2: unchanged: --- a/core/lib/Drupal.php +++ b/core/lib/Drupal.php @@ -461,7 +461,7 @@ public static function urlGenerator() { * displayed outside the site, such as in an RSS feed. * - 'language': An optional language object used to look up the alias * for the URL. If $options['language'] is omitted, the language will be - * obtained from \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_URL). + * obtained from \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_URL). * - 'https': Whether this URL should point to a secure location. If not * defined, the current scheme is used, so the user stays on HTTP or HTTPS * respectively. if mixed mode sessions are permitted, TRUE enforces HTTPS only in patch2: unchanged: --- a/core/lib/Drupal/Core/Config/ConfigFactoryInterface.php +++ b/core/lib/Drupal/Core/Config/ConfigFactoryInterface.php @@ -7,9 +7,6 @@ namespace Drupal\Core\Config; -use Drupal\Core\Language\Language; -use Drupal\Core\Language\LanguageDefault; - /** * Defines the interface for a configuration object factory. */ only in patch2: unchanged: --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -13,7 +13,7 @@ use Drupal\Core\Entity\Entity; use Drupal\Core\Config\ConfigDuplicateUUIDException; use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Defines a base configuration entity class. @@ -84,7 +84,7 @@ * * @var string */ - public $langcode = Language::LANGCODE_NOT_SPECIFIED; + public $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; /** * Overrides Entity::__construct(). only in patch2: unchanged: --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php @@ -109,7 +109,7 @@ public function isSyncing(); * entity change is part of an uninstall process, and skip executing your code * if that is the case. * - * For example, \Drupal\language\Entity\Language::preDelete() prevents the API + * For example, \Drupal\language\Entity\LanguageInterface::preDelete() prevents the API * from deleting the default language. However during an uninstall of the * language module it is expected that the default language should be deleted. * only in patch2: unchanged: --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -15,7 +15,7 @@ use Drupal\Core\DependencyInjection\ServiceProviderInterface; use Drupal\Core\DependencyInjection\YamlFileLoader; use Drupal\Core\Extension\ExtensionDiscovery; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; @@ -519,7 +519,7 @@ protected function buildContainer() { // avoids the circular dependencies that would created by // \Drupal\language\LanguageServiceProvider::alter() and allows the default // language to not be English in the installer. - $default_language_values = Language::$defaultValues; + $default_language_values = LanguageInterface::$defaultValues; if ($system = $this->getConfigStorage()->read('system.site')) { if ($default_language_values['id'] != $system['langcode']) { $default_language_values = array('id' => $system['langcode'], 'default' => TRUE); only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -15,6 +15,7 @@ use Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException; use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; @@ -281,7 +282,7 @@ public function access($operation, AccountInterface $account = NULL) { } return $this->entityManager() ->getAccessController($this->entityTypeId) - ->access($this, $operation, Language::LANGCODE_DEFAULT, $account); + ->access($this, $operation, LanguageInterface::LANGCODE_DEFAULT, $account); } /** @@ -291,7 +292,7 @@ public function language() { $language = $this->languageManager()->getLanguage($this->langcode); if (!$language) { // Make sure we return a proper language object. - $language = new Language(array('id' => Language::LANGCODE_NOT_SPECIFIED)); + $language = new Language(array('id' => LanguageInterface::LANGCODE_NOT_SPECIFIED)); } return $language; } only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/EntityAccessController.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessController.php @@ -11,7 +11,7 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; /** @@ -54,7 +54,7 @@ public function __construct(EntityTypeInterface $entity_type) { /** * {@inheritdoc} */ - public function access(EntityInterface $entity, $operation, $langcode = Language::LANGCODE_DEFAULT, AccountInterface $account = NULL) { + public function access(EntityInterface $entity, $operation, $langcode = LanguageInterface::LANGCODE_DEFAULT, AccountInterface $account = NULL) { $account = $this->prepareUser($account); if (($access = $this->getCache($entity->uuid(), $operation, $langcode, $account)) !== NULL) { @@ -203,7 +203,7 @@ public function resetCache() { public function createAccess($entity_bundle = NULL, AccountInterface $account = NULL, array $context = array()) { $account = $this->prepareUser($account); $context += array( - 'langcode' => Language::LANGCODE_DEFAULT, + 'langcode' => LanguageInterface::LANGCODE_DEFAULT, ); $cid = $entity_bundle ? 'create:' . $entity_bundle : 'create'; only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php @@ -10,7 +10,7 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; /** @@ -31,7 +31,7 @@ * Usually one of "view", "update" or "delete". * @param string $langcode * (optional) The language code for which to check access. Defaults to - * Language::LANGCODE_DEFAULT. + * LanguageInterface::LANGCODE_DEFAULT. * @param \Drupal\Core\Session\AccountInterface $account * (optional) The user session for which to check access, or NULL to check * access for the current user. Defaults to NULL. @@ -39,7 +39,7 @@ * @return bool * TRUE if access was granted, FALSE otherwise. */ - public function access(EntityInterface $entity, $operation, $langcode = Language::LANGCODE_DEFAULT, AccountInterface $account = NULL); + public function access(EntityInterface $entity, $operation, $langcode = LanguageInterface::LANGCODE_DEFAULT, AccountInterface $account = NULL); /** * Checks access to create an entity. only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php +++ b/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php @@ -94,7 +94,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI */ public function doCreate(array $values = array()) { // Set default language to site default if not provided. - $values += array('langcode' => $this->languageManager->getDefaultLanguage()->id); + $values += array('langcode' => $this->languageManager->getDefaultLanguage()->getId()); $entity = new $this->entityClass($values, $this->entityTypeId); // @todo This is handled by ContentEntityStorageBase, which assumes only in patch2: unchanged: --- a/core/lib/Drupal/Core/Field/FieldItemList.php +++ b/core/lib/Drupal/Core/Field/FieldItemList.php @@ -11,7 +11,7 @@ use Drupal\Core\TypedData\DataDefinitionInterface; use Drupal\Core\TypedData\TypedDataInterface; use Drupal\Core\TypedData\Plugin\DataType\ItemList; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Represents an entity field; that is, a list of field item objects. @@ -36,7 +36,7 @@ class FieldItemList extends ItemList implements FieldItemListInterface { * * @var string */ - protected $langcode = Language::LANGCODE_NOT_SPECIFIED; + protected $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; /** * {@inheritdoc} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php @@ -9,7 +9,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Field\FieldItemBase; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\TypedData\DataDefinition; use Drupal\Core\TypedData\DataReferenceDefinition; @@ -92,7 +92,7 @@ public function setValue($values, $notify = TRUE) { */ public function applyDefaultValue($notify = TRUE) { // Default to LANGCODE_NOT_SPECIFIED. - $this->setValue(array('value' => Language::LANGCODE_NOT_SPECIFIED), $notify); + $this->setValue(array('value' => LanguageInterface::LANGCODE_NOT_SPECIFIED), $notify); return $this; } only in patch2: unchanged: --- a/core/lib/Drupal/Core/Path/AliasStorage.php +++ b/core/lib/Drupal/Core/Path/AliasStorage.php @@ -9,7 +9,7 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Provides a class for CRUD operations on path aliases. @@ -46,7 +46,7 @@ public function __construct(Connection $connection, ModuleHandlerInterface $modu /** * {@inheritdoc} */ - public function save($source, $alias, $langcode = Language::LANGCODE_NOT_SPECIFIED, $pid = NULL) { + public function save($source, $alias, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED, $pid = NULL) { $fields = array( 'source' => $source, @@ -114,7 +114,7 @@ public function preloadPathAlias($preloaded, $langcode) { $args = array( ':system' => $preloaded, ':langcode' => $langcode, - ':langcode_undetermined' => Language::LANGCODE_NOT_SPECIFIED, + ':langcode_undetermined' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); // Always get the language-specific alias before the language-neutral one. // For example 'de' is less than 'und' so the order needs to be ASC, while @@ -123,12 +123,12 @@ public function preloadPathAlias($preloaded, $langcode) { // created alias for each source. Subsequent queries using fetchField() must // use pid DESC to have the same effect. For performance reasons, the query // builder is not used here. - if ($langcode == Language::LANGCODE_NOT_SPECIFIED) { + if ($langcode == LanguageInterface::LANGCODE_NOT_SPECIFIED) { // Prevent PDO from complaining about a token the query doesn't use. unset($args[':langcode']); $result = $this->connection->query('SELECT source, alias FROM {url_alias} WHERE source IN (:system) AND langcode = :langcode_undetermined ORDER BY pid ASC', $args); } - elseif ($langcode < Language::LANGCODE_NOT_SPECIFIED) { + elseif ($langcode < LanguageInterface::LANGCODE_NOT_SPECIFIED) { $result = $this->connection->query('SELECT source, alias FROM {url_alias} WHERE source IN (:system) AND langcode IN (:langcode, :langcode_undetermined) ORDER BY langcode ASC, pid ASC', $args); } else { @@ -145,14 +145,14 @@ public function lookupPathAlias($path, $langcode) { $args = array( ':source' => $path, ':langcode' => $langcode, - ':langcode_undetermined' => Language::LANGCODE_NOT_SPECIFIED, + ':langcode_undetermined' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); // See the queries above. - if ($langcode == Language::LANGCODE_NOT_SPECIFIED) { + if ($langcode == LanguageInterface::LANGCODE_NOT_SPECIFIED) { unset($args[':langcode']); $alias = $this->connection->query("SELECT alias FROM {url_alias} WHERE source = :source AND langcode = :langcode_undetermined ORDER BY pid DESC", $args)->fetchField(); } - elseif ($langcode > Language::LANGCODE_NOT_SPECIFIED) { + elseif ($langcode > LanguageInterface::LANGCODE_NOT_SPECIFIED) { $alias = $this->connection->query("SELECT alias FROM {url_alias} WHERE source = :source AND langcode IN (:langcode, :langcode_undetermined) ORDER BY langcode DESC, pid DESC", $args)->fetchField(); } else { @@ -169,14 +169,14 @@ public function lookupPathSource($path, $langcode) { $args = array( ':alias' => $path, ':langcode' => $langcode, - ':langcode_undetermined' => Language::LANGCODE_NOT_SPECIFIED, + ':langcode_undetermined' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); // See the queries above. - if ($langcode == Language::LANGCODE_NOT_SPECIFIED) { + if ($langcode == LanguageInterface::LANGCODE_NOT_SPECIFIED) { unset($args[':langcode']); $result = $this->connection->query("SELECT source FROM {url_alias} WHERE alias = :alias AND langcode = :langcode_undetermined ORDER BY pid DESC", $args); } - elseif ($langcode > Language::LANGCODE_NOT_SPECIFIED) { + elseif ($langcode > LanguageInterface::LANGCODE_NOT_SPECIFIED) { $result = $this->connection->query("SELECT source FROM {url_alias} WHERE alias = :alias AND langcode IN (:langcode, :langcode_undetermined) ORDER BY langcode DESC, pid DESC", $args); } else { @@ -217,7 +217,7 @@ public function aliasExists($alias, $langcode, $source = NULL) { * TRUE if aliases with language exist. */ public function languageAliasExists() { - return (bool) $this->connection->queryRange('SELECT 1 FROM {url_alias} WHERE langcode <> :langcode', 0, 1, array(':langcode' => Language::LANGCODE_NOT_SPECIFIED))->fetchField(); + return (bool) $this->connection->queryRange('SELECT 1 FROM {url_alias} WHERE langcode <> :langcode', 0, 1, array(':langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED))->fetchField(); } /** only in patch2: unchanged: --- a/core/lib/Drupal/Core/Path/AliasStorageInterface.php +++ b/core/lib/Drupal/Core/Path/AliasStorageInterface.php @@ -7,7 +7,7 @@ namespace Drupal\Core\Path; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Provides a class for CRUD operations on path aliases. @@ -34,7 +34,7 @@ * - pid (int): Unique path alias identifier. * - langcode (string): The language code of the alias. */ - public function save($source, $alias, $langcode = Language::LANGCODE_NOT_SPECIFIED, $pid = NULL); + public function save($source, $alias, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED, $pid = NULL); /** * Fetches a specific URL alias from the database. only in patch2: unchanged: --- a/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php +++ b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php @@ -55,7 +55,7 @@ * - 'language': An optional language object. If the path being linked to is * internal to the site, $options['language'] is used to look up the alias * for the URL. If $options['language'] is omitted, the language will be - * obtained from \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_URL). + * obtained from \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_URL). * - 'https': Whether this URL should point to a secure location. If not * defined, the current scheme is used, so the user stays on HTTP or HTTPS * respectively. TRUE enforces HTTPS and FALSE enforces HTTP, but HTTPS can @@ -122,7 +122,7 @@ public function getPathFromRoute($name, $parameters = array()); * displayed outside the site, such as in an RSS feed. * - 'language': An optional language object used to look up the alias * for the URL. If $options['language'] is omitted, it defaults to the - * current language for the language type Language::TYPE_URL. + * current language for the language type LanguageInterface::TYPE_URL. * - 'https': Whether this URL should point to a secure location. If not * defined, the current scheme is used, so the user stays on HTTP or HTTPS * respectively. if mixed mode sessions are permitted, TRUE enforces HTTPS only in patch2: unchanged: --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -83,7 +83,7 @@ class Url extends DependencySerialization { * displayed outside the site, such as in an RSS feed. * - 'language': An optional language object used to look up the alias * for the URL. If $options['language'] is omitted, it defaults to the - * current language for the language type Language::TYPE_URL. + * current language for the language type LanguageInterface::TYPE_URL. * - 'https': Whether this URL should point to a secure location. If not * defined, the current scheme is used, so the user stays on HTTP or HTTPS * respectively. if mixed mode sessions are permitted, TRUE enforces HTTPS only in patch2: unchanged: --- a/core/lib/Drupal/Core/Utility/LinkGenerator.php +++ b/core/lib/Drupal/Core/Utility/LinkGenerator.php @@ -81,7 +81,7 @@ public function generateFromUrl($text, Url $url) { // Add a hreflang attribute if we know the language of this link's url and // hreflang has not already been set. if (!empty($variables['options']['language']) && !isset($variables['options']['attributes']['hreflang'])) { - $variables['options']['attributes']['hreflang'] = $variables['options']['language']->id; + $variables['options']['attributes']['hreflang'] = $variables['options']['language']->getId(); } // Set the "active" class if the 'set_active_class' option is not empty. only in patch2: unchanged: --- a/core/lib/Drupal/Core/Utility/Token.php +++ b/core/lib/Drupal/Core/Utility/Token.php @@ -9,7 +9,7 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; /** @@ -311,7 +311,7 @@ public function findWithPrefix(array $tokens, $prefix, $delimiter = ':') { */ public function getInfo() { if (is_null($this->tokenInfo)) { - $cache_id = 'token_info:' . $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->id; + $cache_id = 'token_info:' . $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId(); $cache = $this->cache->get($cache_id); if ($cache) { $this->tokenInfo = $cache->data; only in patch2: unchanged: --- a/core/modules/aggregator/aggregator.install +++ b/core/modules/aggregator/aggregator.install @@ -4,7 +4,6 @@ * @file * Install, update and uninstall functions for the aggregator module. */ -use Drupal\Core\Language\Language; /** * Implements hook_requirements(). only in patch2: unchanged: --- a/core/modules/aggregator/lib/Drupal/aggregator/FeedForm.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/FeedForm.php @@ -10,7 +10,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -30,8 +30,8 @@ public function form(array $form, array &$form_state) { $form['langcode'] = array( '#title' => $this->t('Language'), '#type' => 'language_select', - '#default_value' => $feed->language()->id, - '#languages' => Language::STATE_ALL, + '#default_value' => $feed->language()->getId(), + '#languages' => LanguageInterface::STATE_ALL, '#weight' => -4, ); only in patch2: unchanged: --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php @@ -7,7 +7,6 @@ namespace Drupal\aggregator\Tests; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; use Drupal\aggregator\FeedInterface; only in patch2: unchanged: --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedLanguageTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedLanguageTest.php @@ -55,14 +55,15 @@ public function setUp() { * Tests creation of feeds with a language. */ public function testFeedLanguage() { + /** @var \Drupal\aggregator\FeedInterface[] $feeds */ $feeds = array(); // Create feeds. $feeds[1] = $this->createFeed(NULL, array('langcode' => $this->langcodes[1]->id)); $feeds[2] = $this->createFeed(NULL, array('langcode' => $this->langcodes[2]->id)); // Make sure that the language has been assigned. - $this->assertEqual($feeds[1]->language()->id, $this->langcodes[1]->id); - $this->assertEqual($feeds[2]->language()->id, $this->langcodes[2]->id); + $this->assertEqual($feeds[1]->language()->getId(), $this->langcodes[1]->id); + $this->assertEqual($feeds[2]->language()->getId(), $this->langcodes[2]->id); // Create example nodes to create feed items from and then update the feeds. $this->createSampleNodes(); @@ -71,10 +72,11 @@ public function testFeedLanguage() { // Loop over the created feed items and verify that their language matches // the one from the feed. foreach ($feeds as $feed) { + /** @var \Drupal\aggregator\ItemInterface[] $items */ $items = entity_load_multiple_by_properties('aggregator_item', array('fid' => $feed->id())); $this->assertTrue(count($items) > 0, 'Feed items were created.'); foreach ($items as $item) { - $this->assertEqual($item->language()->id, $feed->language()->id); + $this->assertEqual($item->language()->getId(), $feed->language()->getId()); } } } only in patch2: unchanged: --- a/core/modules/block/block.install +++ b/core/modules/block/block.install @@ -5,8 +5,6 @@ * Install, update and uninstall functions for the block module. */ -use Drupal\Core\Language\Language; - /** * Implements hook_install(). */ only in patch2: unchanged: --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockSaveTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockSaveTest.php @@ -7,8 +7,6 @@ namespace Drupal\custom_block\Tests; -use Drupal\Core\Language\Language; - /** * Tests block save related functionality. */ only in patch2: unchanged: --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php @@ -7,8 +7,6 @@ namespace Drupal\custom_block\Tests; -use Drupal\Core\Language\Language; - /** * Tests the block edit functionality. */ only in patch2: unchanged: --- a/core/modules/block/lib/Drupal/block/BlockBase.php +++ b/core/modules/block/lib/Drupal/block/BlockBase.php @@ -11,7 +11,7 @@ use Drupal\block\BlockInterface; use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\NestedArray; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheableInterface; use Drupal\Core\Session\AccountInterface; @@ -247,7 +247,7 @@ public function getMachineNameSuggestion() { // \Drupal\system\MachineNameController::transliterate(), so it might make // sense to provide a common service for the two. $transliteration_service = \Drupal::transliteration(); - $transliterated = $transliteration_service->transliterate($admin_label, Language::LANGCODE_DEFAULT, '_'); + $transliterated = $transliteration_service->transliterate($admin_label, LanguageInterface::LANGCODE_DEFAULT, '_'); $replace_pattern = '[^a-z0-9_.]+'; only in patch2: unchanged: --- a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php +++ b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php @@ -15,7 +15,6 @@ use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityViewBuilder; use Drupal\entity\Entity\EntityViewDisplay; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\field\FieldInfo; use Symfony\Component\DependencyInjection\ContainerInterface; only in patch2: unchanged: --- a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php +++ b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php @@ -13,7 +13,6 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldDefinition; -use Drupal\Core\Language\Language; use Drupal\Core\TypedData\DataDefinition; use Drupal\user\UserInterface; only in patch2: unchanged: --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php @@ -7,7 +7,7 @@ namespace Drupal\comment\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\comment\CommentInterface; /** @@ -59,8 +59,8 @@ function testCommentClasses() { 'uid' => $case['comment_uid'], 'status' => $case['comment_status'], 'subject' => $this->randomName(), - 'language' => Language::LANGCODE_NOT_SPECIFIED, - 'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomName())), + 'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED, + 'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomName())), )); $comment->save(); only in patch2: unchanged: --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php @@ -8,7 +8,7 @@ namespace Drupal\comment\Tests; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\comment\CommentInterface; /** @@ -152,8 +152,8 @@ function setEnvironment(array $info) { 'status' => CommentInterface::PUBLISHED, 'subject' => $this->randomName(), 'hostname' => '127.0.0.1', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, - 'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomName())), + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, + 'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomName())), )); $comment->save(); $this->comment = $comment; only in patch2: unchanged: --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php @@ -8,7 +8,7 @@ namespace Drupal\comment\Tests; use Drupal\Component\Serialization\Json; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\comment\CommentInterface; /** @@ -100,8 +100,8 @@ public function testCommentNewCommentsIndicator() { 'status' => CommentInterface::PUBLISHED, 'subject' => $this->randomName(), 'hostname' => '127.0.0.1', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, - 'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomName())), + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, + 'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomName())), )); $comment->save(); $this->drupalLogout(); only in patch2: unchanged: --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php @@ -7,7 +7,6 @@ namespace Drupal\comment\Tests; -use Drupal\Core\Language\Language; use Drupal\comment\CommentInterface; use Drupal\simpletest\WebTestBase; only in patch2: unchanged: --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php @@ -7,7 +7,6 @@ namespace Drupal\comment\Tests; -use Drupal\Core\Language\Language; /** * Tests comment threading. only in patch2: unchanged: --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php @@ -12,7 +12,6 @@ use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Config\Entity\ConfigEntityStorage; use Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; /** only in patch2: unchanged: --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestAccessController.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestAccessController.php @@ -10,7 +10,6 @@ use Drupal\Core\Session\AccountInterface; use Drupal\Core\Entity\EntityAccessController; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; /** * Defines the access controller for the config_test entity type. only in patch2: unchanged: --- a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationUiTest.php @@ -494,7 +494,7 @@ public function testSourceAndTargetLanguage() { $this->container ->get('config.factory') ->get('system.site') - ->set('langcode', Language::LANGCODE_NOT_SPECIFIED) + ->set('langcode', LanguageInterface::LANGCODE_NOT_SPECIFIED) ->save(); // Make sure translation tab does not exist on the configuration page. only in patch2: unchanged: --- a/core/modules/config_translation/tests/Drupal/config_translation/Tests/ConfigMapperManagerTest.php +++ b/core/modules/config_translation/tests/Drupal/config_translation/Tests/ConfigMapperManagerTest.php @@ -9,6 +9,7 @@ use Drupal\config_translation\ConfigMapperManager; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\TypedData\TypedDataInterface; use Drupal\Tests\UnitTestCase; @@ -50,7 +51,7 @@ public function setUp() { $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); $language_manager->expects($this->once()) ->method('getCurrentLanguage') - ->with(Language::TYPE_INTERFACE) + ->with(LanguageInterface::TYPE_INTERFACE) ->will($this->returnValue($language)); $this->typedConfigManager = $this->getMockBuilder('Drupal\Core\Config\TypedConfigManager') only in patch2: unchanged: --- a/core/modules/contact/contact.install +++ b/core/modules/contact/contact.install @@ -5,8 +5,6 @@ * Install, update and uninstall functions for the contact module. */ -use Drupal\Core\Language\Language; - /** * Implements hook_install(). */ only in patch2: unchanged: --- a/core/modules/content_translation/content_translation.admin.inc +++ b/core/modules/content_translation/content_translation.admin.inc @@ -7,7 +7,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element; use Drupal\field\Field as FieldService; use Drupal\field\FieldInstanceConfigInterface; @@ -278,7 +278,7 @@ function content_translation_form_language_content_settings_validate(array $form $values = $bundle_settings['settings']['language']; if (empty($values['language_show']) && \Drupal::languageManager()->isLanguageLocked($values['langcode'])) { - foreach (\Drupal::languageManager()->getLanguages(Language::STATE_LOCKED) as $language) { + foreach (\Drupal::languageManager()->getLanguages(LanguageInterface::STATE_LOCKED) as $language) { $locked_languages[] = $language->name; } form_set_error($name, $form_state, t('Translation is not supported if language is always one of: @locked_languages', array('@locked_languages' => implode(', ', $locked_languages)))); only in patch2: unchanged: --- a/core/modules/content_translation/content_translation.install +++ b/core/modules/content_translation/content_translation.install @@ -6,7 +6,7 @@ */ use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl; /** @@ -87,7 +87,7 @@ function content_translation_install() { // Assign a fairly low weight to ensure our implementation of // hook_module_implements_alter() is run among the last ones. module_set_weight('content_translation', 10); - \Drupal::service('language_negotiator')->saveConfiguration(Language::TYPE_CONTENT, array(LanguageNegotiationUrl::METHOD_ID => 0)); + \Drupal::service('language_negotiator')->saveConfiguration(LanguageInterface::TYPE_CONTENT, array(LanguageNegotiationUrl::METHOD_ID => 0)); $config_names = \Drupal::configFactory()->listAll('field.field.'); foreach ($config_names as $name) { only in patch2: unchanged: --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -11,7 +11,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldDefinition; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\TypedData\TranslatableInterface; use Drupal\node\NodeInterface; @@ -70,8 +70,8 @@ function content_translation_module_implements_alter(&$implementations, $hook) { function content_translation_language_types_info_alter(array &$language_types) { // Make content language negotiation configurable by removing the 'locked' // flag. - $language_types[Language::TYPE_CONTENT]['locked'] = FALSE; - unset($language_types[Language::TYPE_CONTENT]['fixed']); + $language_types[LanguageInterface::TYPE_CONTENT]['locked'] = FALSE; + unset($language_types[LanguageInterface::TYPE_CONTENT]['fixed']); } /** @@ -790,7 +790,7 @@ function content_translation_language_configuration_element_validate($element, a $key = $form_state['content_translation']['key']; $values = $form_state['values'][$key]; if (!$values['language_show'] && $values['content_translation'] && \Drupal::languageManager()->isLanguageLocked($values['langcode'])) { - foreach (\Drupal::languageManager()->getLanguages(Language::STATE_LOCKED) as $language) { + foreach (\Drupal::languageManager()->getLanguages(LanguageInterface::STATE_LOCKED) as $language) { $locked_languages[] = $language->name; } // @todo Set the correct form element name as soon as the element parents only in patch2: unchanged: --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSettingsTest.php @@ -7,7 +7,7 @@ namespace Drupal\content_translation\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\field\Field as FieldService; use Drupal\simpletest\WebTestBase; @@ -76,7 +76,7 @@ function testSettingsUI() { // language is set as default and the language selector is hidden. $edit = array( 'entity_types[comment]' => TRUE, - 'settings[comment][node__comment_article][settings][language][langcode]' => Language::LANGCODE_NOT_SPECIFIED, + 'settings[comment][node__comment_article][settings][language][langcode]' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'settings[comment][node__comment_article][settings][language][language_show]' => FALSE, 'settings[comment][node__comment_article][translatable]' => TRUE, 'settings[comment][node__comment_article][fields][comment_body]' => TRUE, only in patch2: unchanged: --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php @@ -8,7 +8,6 @@ namespace Drupal\content_translation\Tests; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; /** * Tests the Content Translation image field synchronization capability. only in patch2: unchanged: --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncUnitTest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncUnitTest.php @@ -7,7 +7,6 @@ namespace Drupal\content_translation\Tests; -use Drupal\Core\Language\Language; use Drupal\simpletest\DrupalUnitTestBase; use Drupal\content_translation\FieldTranslationSynchronizer; only in patch2: unchanged: --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationTestBase.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationTestBase.php @@ -103,7 +103,7 @@ protected function setupLanguages() { foreach ($this->langcodes as $langcode) { language_save(new Language(array('id' => $langcode))); } - array_unshift($this->langcodes, \Drupal::languageManager()->getDefaultLanguage()->id); + array_unshift($this->langcodes, \Drupal::languageManager()->getDefaultLanguage()->getId()); } /** only in patch2: unchanged: --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php @@ -9,7 +9,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\ContentEntityBase; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests the Content Translation UI. @@ -242,7 +242,7 @@ protected function getNewEntityValues($langcode) { */ protected function getEditValues($values, $langcode, $new = FALSE) { $edit = $values[$langcode]; - $langcode = $new ? Language::LANGCODE_NOT_SPECIFIED : $langcode; + $langcode = $new ? LanguageInterface::LANGCODE_NOT_SPECIFIED : $langcode; foreach ($values[$langcode] as $property => $value) { if (is_array($value)) { $edit["{$property}[0][value]"] = $value[0]['value']; only in patch2: unchanged: --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php @@ -7,7 +7,7 @@ namespace Drupal\content_translation\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\user\UserInterface; /** @@ -183,7 +183,7 @@ protected function assertWorkflows(UserInterface $user, $expected_status) { * Assert that the current page does not contain shared form elements. */ protected function assertNoSharedElements() { - $language_none = Language::LANGCODE_NOT_SPECIFIED; + $language_none = LanguageInterface::LANGCODE_NOT_SPECIFIED; return $this->assertNoFieldByXPath("//input[@name='field_test_text[$language_none][0][value]']", NULL, 'Shared elements are not available on the translation form.'); } only in patch2: unchanged: --- a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php +++ b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php @@ -8,7 +8,6 @@ namespace Drupal\dblog\Tests; use Drupal\Component\Utility\Xss; -use Drupal\Core\Language\Language; use Drupal\dblog\Controller\DbLogController; use Drupal\simpletest\WebTestBase; only in patch2: unchanged: --- a/core/modules/editor/lib/Drupal/editor/Tests/QuickEditIntegrationTest.php +++ b/core/modules/editor/lib/Drupal/editor/Tests/QuickEditIntegrationTest.php @@ -8,7 +8,7 @@ namespace Drupal\editor\Tests; use Drupal\Component\Serialization\Json; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\quickedit\EditorSelector; use Drupal\quickedit\MetadataGenerator; use Drupal\quickedit\Plugin\InPlaceEditorManager; @@ -111,7 +111,7 @@ public function setUp() { */ protected function getSelectedEditor($entity_id, $field_name, $view_mode = 'default') { $entity = entity_load('entity_test', $entity_id, TRUE); - $items = $entity->getTranslation(Language::LANGCODE_NOT_SPECIFIED)->get($field_name); + $items = $entity->getTranslation(LanguageInterface::LANGCODE_NOT_SPECIFIED)->get($field_name); $options = entity_get_display('entity_test', 'entity_test', $view_mode)->getComponent($field_name); return $this->editorSelector->getEditor($options['type'], $items); } @@ -164,7 +164,7 @@ public function testMetadata() { $entity = entity_load('entity_test', $this->entity->id()); // Verify metadata. - $items = $entity->getTranslation(Language::LANGCODE_NOT_SPECIFIED)->get($this->field_name); + $items = $entity->getTranslation(LanguageInterface::LANGCODE_NOT_SPECIFIED)->get($this->field_name); $metadata = $this->metadataGenerator->generateFieldMetadata($items, 'default'); $expected = array( 'access' => TRUE, @@ -193,7 +193,7 @@ public function testGetUntransformedTextCommand() { // Verify AJAX response. $controller = new EditorController(); $request = new Request(); - $response = $controller->getUntransformedText($entity, $this->field_name, Language::LANGCODE_NOT_SPECIFIED, 'default'); + $response = $controller->getUntransformedText($entity, $this->field_name, LanguageInterface::LANGCODE_NOT_SPECIFIED, 'default'); $expected = array( array( 'command' => 'editorGetUntransformedText', only in patch2: unchanged: --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php @@ -8,7 +8,6 @@ namespace Drupal\entity_reference\Tests; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; /** only in patch2: unchanged: --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php @@ -9,7 +9,7 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\field\Tests\FieldUnitTestBase; /** @@ -58,14 +58,14 @@ public function setUp() { $this->vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $this->vocabulary->save(); $this->term = entity_create('taxonomy_term', array( 'name' => $this->randomName(), 'vid' => $this->vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $this->term->save(); @@ -106,7 +106,7 @@ public function testContentEntityReferenceItem() { $term2 = entity_create('taxonomy_term', array( 'name' => $this->randomName(), 'vid' => $this->term->bundle(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term2->save(); @@ -153,7 +153,7 @@ public function testConfigEntityReferenceItem() { $vocabulary2 = entity_create('taxonomy_vocabulary', array( 'name' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $vocabulary2->save(); only in patch2: unchanged: --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php @@ -8,7 +8,7 @@ namespace Drupal\entity_reference\Tests; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\comment\CommentInterface; use Drupal\simpletest\WebTestBase; @@ -410,7 +410,7 @@ public function testCommentHandler() { 'pid' => 0, 'status' => CommentInterface::PUBLISHED, 'subject' => 'Comment Published <&>', - 'language' => Language::LANGCODE_NOT_SPECIFIED, + 'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ), 'published_unpublished' => array( 'entity_id' => $nodes['published']->id(), @@ -421,7 +421,7 @@ public function testCommentHandler() { 'pid' => 0, 'status' => CommentInterface::NOT_PUBLISHED, 'subject' => 'Comment Unpublished <&>', - 'language' => Language::LANGCODE_NOT_SPECIFIED, + 'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ), 'unpublished_published' => array( 'entity_id' => $nodes['unpublished']->id(), @@ -432,7 +432,7 @@ public function testCommentHandler() { 'pid' => 0, 'status' => CommentInterface::NOT_PUBLISHED, 'subject' => 'Comment Published on Unpublished node <&>', - 'language' => Language::LANGCODE_NOT_SPECIFIED, + 'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ), ); only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php @@ -7,7 +7,7 @@ namespace Drupal\field\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; class DisplayApiTest extends FieldUnitTestBase { @@ -146,7 +146,7 @@ function testFieldItemListView() { $setting = $display['settings']['test_formatter_setting_multiple']; $this->assertNoText($this->label, 'Label was not displayed.'); $this->assertText('field_test_entity_display_build_alter', 'Alter fired, display passed.'); - $this->assertText('entity language is ' . Language::LANGCODE_NOT_SPECIFIED, 'Language is placed onto the context.'); + $this->assertText('entity language is ' . LanguageInterface::LANGCODE_NOT_SPECIFIED, 'Language is placed onto the context.'); $array = array(); foreach ($this->values as $delta => $value) { $array[] = $delta . ':' . $value['value']; only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php @@ -7,7 +7,7 @@ namespace Drupal\field\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Unit test class for non-storage related field_attach_* functions. @@ -180,7 +180,7 @@ function testEntityDisplayViewMultiple() { function testFieldAttachCache() { // Initialize random values and a test entity. $entity_init = entity_create('entity_test', array('type' => $this->instance->bundle)); - $langcode = Language::LANGCODE_NOT_SPECIFIED; + $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; $values = $this->_generateTestFieldValues($this->field->getCardinality()); // Non-cacheable entity type. only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php @@ -7,8 +7,6 @@ namespace Drupal\field\Tests; -use Drupal\Core\Language\Language; - class FieldInfoTest extends FieldUnitTestBase { public static function getInfo() { only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php @@ -8,7 +8,7 @@ namespace Drupal\field\Tests; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -46,11 +46,11 @@ function _generateTestFieldValues($cardinality) { * The array of expected values. * @param $langcode * (Optional) The language code for the values. Defaults to - * Drupal\Core\Language\Language::LANGCODE_NOT_SPECIFIED. + * Drupal\Core\Language\LanguageInterface::LANGCODE_NOT_SPECIFIED. * @param $column * (Optional) The name of the column to check. Defaults to 'value'. */ - function assertFieldValues(EntityInterface $entity, $field_name, $expected_values, $langcode = Language::LANGCODE_NOT_SPECIFIED, $column = 'value') { + function assertFieldValues(EntityInterface $entity, $field_name, $expected_values, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED, $column = 'value') { // Re-load the entity to make sure we have the latest changes. entity_get_controller($entity->getEntityTypeId())->resetCache(array($entity->id())); $e = entity_load($entity->getEntityTypeId(), $entity->id()); only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php @@ -9,7 +9,7 @@ use Drupal\Component\Utility\Xss; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\DrupalUnitTestBase; /** @@ -145,11 +145,11 @@ function _generateTestFieldValues($cardinality) { * The array of expected values. * @param $langcode * (Optional) The language code for the values. Defaults to - * Drupal\Core\Language\Language::LANGCODE_NOT_SPECIFIED. + * Drupal\Core\Language\LanguageInterface::LANGCODE_NOT_SPECIFIED. * @param $column * (Optional) The name of the column to check. Defaults to 'value'. */ - function assertFieldValues(EntityInterface $entity, $field_name, $expected_values, $langcode = Language::LANGCODE_NOT_SPECIFIED, $column = 'value') { + function assertFieldValues(EntityInterface $entity, $field_name, $expected_values, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED, $column = 'value') { // Re-load the entity to make sure we have the latest changes. entity_get_controller($entity->getEntityTypeId())->resetCache(array($entity->id())); $e = entity_load($entity->getEntityTypeId(), $entity->id()); only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php @@ -8,7 +8,6 @@ namespace Drupal\field\Tests\Views; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; use Drupal\views\ViewExecutable; use Drupal\views\Views; only in patch2: unchanged: --- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php @@ -7,7 +7,7 @@ namespace Drupal\field_ui\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -39,7 +39,7 @@ function setUp() { 'name' => $this->randomName(), 'description' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'help' => '', 'nodes' => array('article' => 'article'), 'weight' => mt_rand(0, 10), only in patch2: unchanged: --- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php @@ -8,7 +8,7 @@ namespace Drupal\field_ui\Tests; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Component\Utility\String; /** @@ -40,7 +40,7 @@ function setUp() { $vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => 'Tags', 'vid' => 'tags', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $vocabulary->save(); only in patch2: unchanged: --- a/core/modules/file/lib/Drupal/file/Entity/File.php +++ b/core/modules/file/lib/Drupal/file/Entity/File.php @@ -11,7 +11,7 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldDefinition; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\file\FileInterface; use Drupal\user\UserInterface; @@ -43,7 +43,7 @@ class File extends ContentEntityBase implements FileInterface { * @var array */ protected $values = array( - 'langcode' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => Language::LANGCODE_NOT_SPECIFIED))), + 'langcode' => array(LanguageInterface::LANGCODE_DEFAULT => array(0 => array('value' => LanguageInterface::LANGCODE_NOT_SPECIFIED))), ); /** only in patch2: unchanged: --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; - /** * Tests that files are uploaded to proper locations. */ only in patch2: unchanged: --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; - /** * Tests that formatters are working properly. */ only in patch2: unchanged: --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; - /** * Tests file handling with node revisions. */ only in patch2: unchanged: --- a/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; - /** * Tests file access on private nodes. */ only in patch2: unchanged: --- a/core/modules/file/lib/Drupal/file/Tests/SaveTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/SaveTest.php @@ -7,7 +7,7 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests saving files. @@ -46,7 +46,7 @@ function testFileSave() { $this->assertEqual($loaded_file->isPermanent(), $file->isPermanent(), 'Status was saved correctly.'); $this->assertEqual($file->getSize(), filesize($file->getFileUri()), 'File size was set correctly.', 'File'); $this->assertTrue($file->getChangedTime() > 1, 'File size was set correctly.', 'File'); - $this->assertEqual($loaded_file->langcode->value, Language::LANGCODE_NOT_SPECIFIED, 'Langcode was defaulted correctly.'); + $this->assertEqual($loaded_file->langcode->value, LanguageInterface::LANGCODE_NOT_SPECIFIED, 'Langcode was defaulted correctly.'); // Resave the file, updating the existing record. file_test_reset(); only in patch2: unchanged: --- a/core/modules/filter/lib/Drupal/filter/FilterPluginManager.php +++ b/core/modules/filter/lib/Drupal/filter/FilterPluginManager.php @@ -10,7 +10,6 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\Plugin\Discovery\AlterDecorator; only in patch2: unchanged: --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterSecurityTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterSecurityTest.php @@ -7,7 +7,6 @@ namespace Drupal\filter\Tests; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; use Drupal\filter\Plugin\FilterInterface; only in patch2: unchanged: --- a/core/modules/hal/lib/Drupal/hal/Normalizer/ContentEntityNormalizer.php +++ b/core/modules/hal/lib/Drupal/hal/Normalizer/ContentEntityNormalizer.php @@ -10,7 +10,7 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\rest\LinkManager\LinkManagerInterface; use Symfony\Component\Serializer\Exception\UnexpectedValueException; @@ -136,7 +136,7 @@ public function denormalize($data, $class, $format = NULL, array $context = arra $langcode = language_get_default_langcode($typed_data_ids['entity_type'], $typed_data_ids['bundle']); } else { - $langcode = Language::LANGCODE_NOT_SPECIFIED; + $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; } $entity_type = $this->entityManager->getDefinition($typed_data_ids['entity_type']); only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/ConfigurableLanguageManagerInterface.php +++ b/core/modules/language/lib/Drupal/language/ConfigurableLanguageManagerInterface.php @@ -7,7 +7,6 @@ namespace Drupal\language; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManagerInterface; use Symfony\Component\HttpFoundation\Request; only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Entity/Language.php +++ b/core/modules/language/lib/Drupal/language/Entity/Language.php @@ -87,9 +87,9 @@ class Language extends ConfigEntityBase implements LanguageInterface { * container using the language.default service in when the entity is saved. * The value is set correctly when a language entity is created or loaded. * - * @see \Drupal\language\Entity\Language::postSave() - * @see \Drupal\language\Entity\Language::isDefault() - * @see \Drupal\language\Entity\Language::setDefault() + * @see \Drupal\language\Entity\LanguageInterface::postSave() + * @see \Drupal\language\Entity\LanguageInterface::isDefault() + * @see \Drupal\language\Entity\LanguageInterface::setDefault() * * @var bool */ @@ -101,8 +101,8 @@ class Language extends ConfigEntityBase implements LanguageInterface { * This property is not saved to the language entity, but is needed for * detecting when to rebuild the services. * - * @see \Drupal\language\Entity\Language::preSave() - * @see \Drupal\language\Entity\Language::postSave() + * @see \Drupal\language\Entity\LanguageInterface::preSave() + * @see \Drupal\language\Entity\LanguageInterface::postSave() * * @var bool */ @@ -137,7 +137,7 @@ public function preSave(EntityStorageInterface $storage) { parent::preSave($storage); // Store whether or not the site is already multilingual so that we can // rebuild services if necessary during - // \Drupal\language\Entity\Language::postSave(). + // \Drupal\language\Entity\LanguageInterface::postSave(). $this->preSaveMultilingual = \Drupal::languageManager()->isMultilingual(); // Languages are picked from a predefined list which is given in English. // For the uncommon case of custom languages the label should be given in only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Form/LanguageAddForm.php +++ b/core/modules/language/lib/Drupal/language/Form/LanguageAddForm.php @@ -99,7 +99,7 @@ public function submitForm(array &$form, array &$form_state) { // Save the language and inform the user that it happened. $language = language_save($language); - drupal_set_message($this->t('The language %language has been created and can now be used.', array('%language' => $language->name))); + drupal_set_message($this->t('The language %language has been created and can now be used.', array('%language' => $language->getName()))); // Tell the user they have the option to add a language switcher block // to their theme so they can switch between the languages. @@ -125,7 +125,7 @@ public function validateCustom(array $form, array &$form_state) { $this->validateCommon($form['custom_language'], $form_state); if ($language = language_load($langcode)) { - $this->setFormError('langcode', $form_state, $this->t('The language %language (%langcode) already exists.', array('%language' => $language->name, '%langcode' => $langcode))); + $this->setFormError('langcode', $form_state, $this->t('The language %language (%langcode) already exists.', array('%language' => $language->getName(), '%langcode' => $langcode))); } } else { @@ -143,7 +143,7 @@ public function validatePredefined($form, &$form_state) { } else { if ($language = language_load($langcode)) { - $this->setFormError('predefined_langcode', $form_state, $this->t('The language %language (%langcode) already exists.', array('%language' => $language->name, '%langcode' => $langcode))); + $this->setFormError('predefined_langcode', $form_state, $this->t('The language %language (%langcode) already exists.', array('%language' => $language->getName(), '%langcode' => $langcode))); } } } only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Form/LanguageFormBase.php +++ b/core/modules/language/lib/Drupal/language/Form/LanguageFormBase.php @@ -9,7 +9,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Entity\EntityForm; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Base form for language add and edit forms. @@ -57,8 +57,8 @@ public function commonForm(array &$form) { '#description' => $this->t('Direction that text in this language is presented.'), '#default_value' => $language->direction, '#options' => array( - Language::DIRECTION_LTR => $this->t('Left to right'), - Language::DIRECTION_RTL => $this->t('Right to left'), + LanguageInterface::DIRECTION_LTR => $this->t('Left to right'), + LanguageInterface::DIRECTION_RTL => $this->t('Right to left'), ), ); only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Form/NegotiationSelectedForm.php +++ b/core/modules/language/lib/Drupal/language/Form/NegotiationSelectedForm.php @@ -7,7 +7,7 @@ namespace Drupal\language\Form; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Form\ConfigFormBase; /** @@ -30,7 +30,7 @@ public function buildForm(array $form, array &$form_state) { $form['selected_langcode'] = array( '#type' => 'language_select', '#title' => t('Language'), - '#languages' => Language::STATE_CONFIGURABLE | Language::STATE_SITE_DEFAULT, + '#languages' => LanguageInterface::STATE_CONFIGURABLE | LanguageInterface::STATE_SITE_DEFAULT, '#default_value' => $config->get('selected_langcode'), ); only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/LanguageAccessController.php +++ b/core/modules/language/lib/Drupal/language/LanguageAccessController.php @@ -9,7 +9,6 @@ use Drupal\Core\Entity\EntityAccessController; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; class LanguageAccessController extends EntityAccessController { only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/LanguageNegotiatorInterface.php +++ b/core/modules/language/lib/Drupal/language/LanguageNegotiatorInterface.php @@ -41,7 +41,7 @@ * configurable: * @code * function mymodule_language_types_info_alter(&$language_types) { - * unset($language_types[Language::TYPE_CONTENT]['fixed']); + * unset($language_types[LanguageInterface::TYPE_CONTENT]['fixed']); * } * @endcode * only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/LanguageServiceProvider.php +++ b/core/modules/language/lib/Drupal/language/LanguageServiceProvider.php @@ -10,7 +10,7 @@ use Drupal\Core\Config\BootstrapConfigStorageFactory; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DependencyInjection\ServiceProviderBase; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\DependencyInjection\Reference; /** @@ -81,7 +81,7 @@ protected function isMultilingual() { // container has finished building. $config_storage = BootstrapConfigStorageFactory::get(); $config_ids = array_filter($config_storage->listAll($prefix), function($config_id) use ($prefix) { - return $config_id != $prefix . Language::LANGCODE_NOT_SPECIFIED && $config_id != $prefix . Language::LANGCODE_NOT_APPLICABLE; + return $config_id != $prefix . LanguageInterface::LANGCODE_NOT_SPECIFIED && $config_id != $prefix . LanguageInterface::LANGCODE_NOT_APPLICABLE; }); return count($config_ids) > 1; } only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php @@ -7,7 +7,7 @@ namespace Drupal\language\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -160,7 +160,7 @@ protected function checkConfigurableLanguageWeight($state = 'by default') { \Drupal::languageManager()->reset(); $max_configurable_language_weight = $this->getHighestConfigurableLanguageWeight(); $replacements = array('@event' => $state); - foreach (\Drupal::languageManager()->getLanguages(Language::STATE_LOCKED) as $locked_language) { + foreach (\Drupal::languageManager()->getLanguages(LanguageInterface::STATE_LOCKED) as $locked_language) { $replacements['%language'] = $locked_language->name; $this->assertTrue($locked_language->weight > $max_configurable_language_weight, format_string('System language %language has higher weight than configurable languages @event', $replacements)); } only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Tests/LanguageCustomLanguageConfigurationTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageCustomLanguageConfigurationTest.php @@ -7,6 +7,7 @@ namespace Drupal\language\Tests; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; use Drupal\Core\Language\Language; @@ -57,7 +58,7 @@ public function testLanguageConfiguration() { 'predefined_langcode' => 'custom', 'langcode' => 'white space', 'name' => 'evil markup', - 'direction' => Language::DIRECTION_LTR, + 'direction' => LanguageInterface::DIRECTION_LTR, ); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->assertRaw(t('%field may only contain characters a-z, underscores, or hyphens.', array('%field' => t('Language code')))); @@ -69,7 +70,7 @@ public function testLanguageConfiguration() { 'predefined_langcode' => 'custom', 'langcode' => 'de', 'name' => 'German', - 'direction' => Language::DIRECTION_LTR, + 'direction' => LanguageInterface::DIRECTION_LTR, ); // Add the language the first time. only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php @@ -7,6 +7,7 @@ namespace Drupal\language\Tests; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; use Drupal\Core\Language\Language; @@ -179,10 +180,10 @@ function testLanguageStates() { $expected_all_languages = array('l4' => 'l4', 'l3' => 'l3', 'l2' => 'l2', 'l1' => 'l1', 'en' => 'en', 'und' => 'und', 'zxx' => 'zxx'); $expected_conf_languages = array('l3' => 'l3', 'l1' => 'l1', 'en' => 'en'); - $locked_languages = $this->container->get('language_manager')->getLanguages(Language::STATE_LOCKED); + $locked_languages = $this->container->get('language_manager')->getLanguages(LanguageInterface::STATE_LOCKED); $this->assertEqual(array_diff_key($expected_locked_languages, $locked_languages), array(), 'Locked languages loaded correctly.'); - $all_languages = $this->container->get('language_manager')->getLanguages(Language::STATE_ALL); + $all_languages = $this->container->get('language_manager')->getLanguages(LanguageInterface::STATE_ALL); $this->assertEqual(array_diff_key($expected_all_languages, $all_languages), array(), 'All languages loaded correctly.'); $conf_languages = $this->container->get('language_manager')->getLanguages(); only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php @@ -7,7 +7,7 @@ namespace Drupal\language\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI; use Drupal\simpletest\WebTestBase; @@ -81,7 +81,7 @@ function testInfoAlterations() { 'language_test.language_types' => TRUE, // Enable language_test negotiation info (not altered yet). 'language_test.language_negotiation_info' => TRUE, - // Alter Language::TYPE_CONTENT to be configurable. + // Alter LanguageInterface::TYPE_CONTENT to be configurable. 'language_test.content_language_type' => TRUE, )); $this->container->get('module_handler')->install(array('language_test')); @@ -91,7 +91,7 @@ function testInfoAlterations() { // of saving the language negotiation settings. $this->checkFixedLanguageTypes(); - $type = Language::TYPE_CONTENT; + $type = LanguageInterface::TYPE_CONTENT; $language_types = $this->languageManager()->getLanguageTypes(); $this->assertTrue(in_array($type, $language_types), 'Content language type is configurable.'); @@ -138,7 +138,7 @@ function testInfoAlterations() { $last = $this->container->get('state')->get('language_test.language_negotiation_last'); foreach ($this->languageManager()->getDefinedLanguageTypes() as $type) { $langcode = $last[$type]; - $value = $type == Language::TYPE_CONTENT || strpos($type, 'test') !== FALSE ? 'it' : 'en'; + $value = $type == LanguageInterface::TYPE_CONTENT || strpos($type, 'test') !== FALSE ? 'it' : 'en'; $this->assertEqual($langcode, $value, format_string('The negotiated language for %type is %language', array('%type' => $type, '%language' => $value))); } only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php @@ -7,7 +7,7 @@ namespace Drupal\language\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -43,7 +43,7 @@ function setUp() { */ function testLanguageBlock() { // Enable the language switching block.. - $block = $this->drupalPlaceBlock('language_block:' . Language::TYPE_INTERFACE, array( + $block = $this->drupalPlaceBlock('language_block:' . LanguageInterface::TYPE_INTERFACE, array( 'id' => 'test_language_block', // Ensure a 2-byte UTF-8 sequence is in the tested output. 'label' => $this->randomName(8) . '×', only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php @@ -7,6 +7,7 @@ namespace Drupal\language\Tests; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationBrowser; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationSelected; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl; @@ -243,7 +244,7 @@ function testUILanguageNegotiation() { // Unknown language prefix should return 404. $definitions = \Drupal::languageManager()->getNegotiator()->getNegotiationMethods(); \Drupal::config('language.types') - ->set('negotiation.' . Language::TYPE_INTERFACE . '.enabled', array_flip(array_keys($definitions))) + ->set('negotiation.' . LanguageInterface::TYPE_INTERFACE . '.enabled', array_flip(array_keys($definitions))) ->save(); $this->drupalGet("$langcode_unknown/admin/config", array(), $http_header_browser_fallback); $this->assertResponse(404, "Unknown language path prefix should return 404"); @@ -338,7 +339,7 @@ function testUILanguageNegotiation() { protected function runTest($test) { if (!empty($test['language_negotiation'])) { $method_weights = array_flip($test['language_negotiation']); - $this->container->get('language_negotiator')->saveConfiguration(Language::TYPE_INTERFACE, $method_weights); + $this->container->get('language_negotiator')->saveConfiguration(LanguageInterface::TYPE_INTERFACE, $method_weights); } if (!empty($test['language_negotiation_url_part'])) { \Drupal::config('language.negotiation') @@ -382,7 +383,7 @@ function testUrlLanguageFallback() { $this->drupalGet('admin/config/regional/language/detection'); // Enable the language switcher block. - $this->drupalPlaceBlock('language_block:' . Language::TYPE_INTERFACE, array('id' => 'test_language_block')); + $this->drupalPlaceBlock('language_block:' . LanguageInterface::TYPE_INTERFACE, array('id' => 'test_language_block')); // Log out, because for anonymous users, the "active" class is set by PHP // (which means we can easily test it here), whereas for authenticated users only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Tests/Views/ArgumentLanguageTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/Views/ArgumentLanguageTest.php @@ -7,7 +7,6 @@ namespace Drupal\language\Tests\Views; -use Drupal\Core\Language\Language; use Drupal\views\Views; /** only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Tests/Views/FieldLanguageTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/Views/FieldLanguageTest.php @@ -7,7 +7,6 @@ namespace Drupal\language\Tests\Views; -use Drupal\Core\Language\Language; use Drupal\views\Views; /** only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Tests/Views/FilterLanguageTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/Views/FilterLanguageTest.php @@ -7,7 +7,6 @@ namespace Drupal\language\Tests\Views; -use Drupal\Core\Language\Language; use Drupal\views\Views; /** only in patch2: unchanged: --- a/core/modules/language/tests/language_test/lib/Drupal/language_test/Plugin/LanguageNegotiation/LanguageNegotiationTest.php +++ b/core/modules/language/tests/language_test/lib/Drupal/language_test/Plugin/LanguageNegotiation/LanguageNegotiationTest.php @@ -18,7 +18,7 @@ * weight = -10, * name = @Translation("Test"), * description = @Translation("This is a test language negotiation method."), - * types = {Drupal\Core\Language\Language::TYPE_CONTENT, "test_language_type", "fixed_test_language_type"} + * types = {Drupal\Core\Language\LanguageInterface::TYPE_CONTENT, "test_language_type", "fixed_test_language_type"} * ) */ class LanguageNegotiationTest extends LanguageNegotiationMethodBase { only in patch2: unchanged: --- a/core/modules/locale/lib/Drupal/locale/LocaleTranslation.php +++ b/core/modules/locale/lib/Drupal/locale/LocaleTranslation.php @@ -10,7 +10,7 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\DestructableInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Lock\LockBackendInterface; use Drupal\Core\StringTranslation\Translator\TranslatorInterface; @@ -101,7 +101,7 @@ public function __construct(StringStorageInterface $storage, CacheBackendInterfa */ public function getStringTranslation($langcode, $string, $context) { // If the language is not suitable for locale module, just return. - if ($langcode == Language::LANGCODE_SYSTEM || ($langcode == 'en' && !$this->canTranslateEnglish())) { + if ($langcode == LanguageInterface::LANGCODE_SYSTEM || ($langcode == 'en' && !$this->canTranslateEnglish())) { return FALSE; } // Strings are cached by langcode, context and roles, using instances of the only in patch2: unchanged: --- a/core/modules/locale/lib/Drupal/locale/LocaleTypedConfig.php +++ b/core/modules/locale/lib/Drupal/locale/LocaleTypedConfig.php @@ -7,7 +7,6 @@ namespace Drupal\locale; -use Drupal\Core\Language\Language; use Drupal\Core\TypedData\ContextAwareInterface; use Drupal\Core\Config\Schema\Element; use Drupal\Core\Config\Schema\ArrayElement; only in patch2: unchanged: --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php @@ -7,7 +7,6 @@ namespace Drupal\locale\Tests; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; use Drupal\locale\LocaleTypedConfig; only in patch2: unchanged: --- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php @@ -7,7 +7,7 @@ namespace Drupal\locale\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -106,7 +106,7 @@ function testPathLanguageConfiguration() { $edit = array( 'source' => 'node/' . $node->id(), 'alias' => $custom_path, - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); $this->container->get('path.alias_storage')->save($edit['source'], $edit['alias'], $edit['langcode']); $lookup_path = $this->container->get('path.alias_manager')->getPathAlias('node/' . $node->id(), 'en'); @@ -118,7 +118,7 @@ function testPathLanguageConfiguration() { // Create language nodes to check priority of aliases. $first_node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1, 'langcode' => 'en')); - $second_node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1, 'langcode' => Language::LANGCODE_NOT_SPECIFIED)); + $second_node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1, 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED)); // Assign a custom path alias to the first node with the English language. $edit = array( @@ -128,7 +128,7 @@ function testPathLanguageConfiguration() { ); $this->container->get('path.alias_storage')->save($edit['source'], $edit['alias'], $edit['langcode']); - // Assign a custom path alias to second node with Language::LANGCODE_NOT_SPECIFIED. + // Assign a custom path alias to second node with LanguageInterface::LANGCODE_NOT_SPECIFIED. $edit = array( 'source' => 'node/' . $second_node->id(), 'alias' => $custom_path, only in patch2: unchanged: --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php @@ -8,6 +8,7 @@ namespace Drupal\locale\Tests; use Drupal\Core\Cache\Cache; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; use Drupal\Core\Language\Language; use Drupal\Component\Utility\String; @@ -152,7 +153,7 @@ function testStringTranslation() { $this->container->get('string_translation')->reset(); // Now we should get the proper fresh translation from t(). $this->assertTrue($name != $translation_to_en && t($name, array(), array('langcode' => 'en')) == $translation_to_en, 't() works for English.'); - $this->assertTrue(t($name, array(), array('langcode' => Language::LANGCODE_SYSTEM)) == $name, 't() works for Language::LANGCODE_SYSTEM.'); + $this->assertTrue(t($name, array(), array('langcode' => LanguageInterface::LANGCODE_SYSTEM)) == $name, 't() works for LanguageInterface::LANGCODE_SYSTEM.'); $search = array( 'string' => $name, only in patch2: unchanged: --- a/core/modules/locale/locale.bulk.inc +++ b/core/modules/locale/locale.bulk.inc @@ -6,7 +6,7 @@ */ use Drupal\locale\Gettext; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\file\FileInterface; /** @@ -167,7 +167,7 @@ function locale_translate_batch_build($files, $options) { * * @param object $file * A file object of the gettext file to be imported. The file object must - * contain a language parameter (other than Language::LANGCODE_NOT_SPECIFIED). This + * contain a language parameter (other than LanguageInterface::LANGCODE_NOT_SPECIFIED). This * is used as the language of the import. * * @param array $options @@ -192,7 +192,7 @@ function locale_translate_batch_import($file, $options, &$context) { 'customized' => LOCALE_NOT_CUSTOMIZED, ); - if (isset($file->langcode) && $file->langcode != Language::LANGCODE_NOT_SPECIFIED) { + if (isset($file->langcode) && $file->langcode != LanguageInterface::LANGCODE_NOT_SPECIFIED) { try { if (empty($context['sandbox'])) { @@ -459,7 +459,7 @@ function locale_translate_file_attach_properties($file, $options = array()) { $file->langcode = isset($options['langcode']) ? $options['langcode'] : $matches[5]; } else { - $file->langcode = Language::LANGCODE_NOT_SPECIFIED; + $file->langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; } return $file; } only in patch2: unchanged: --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -5,7 +5,6 @@ * Install, update, and uninstall functions for the Locale module. */ -use Drupal\Core\Language\Language; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationSelected; /** only in patch2: unchanged: --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -6,7 +6,6 @@ */ use Drupal\Component\Utility\String; -use Drupal\Core\Language\Language; use Drupal\Core\Render\Element; use Drupal\locale\SourceString; use Drupal\locale\TranslationString; only in patch2: unchanged: --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkForm.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkForm.php @@ -9,7 +9,7 @@ use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Entity\EntityForm; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Path\AliasManagerInterface; use Drupal\Core\Routing\UrlGenerator; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -181,7 +181,7 @@ public function form(array $form, array &$form_state) { $form['langcode'] = array( '#type' => 'language_select', '#title' => t('Language'), - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#default_value' => $default_langcode, '#access' => $language_show, ); only in patch2: unchanged: --- a/core/modules/menu_ui/lib/Drupal/menu_ui/MenuForm.php +++ b/core/modules/menu_ui/lib/Drupal/menu_ui/MenuForm.php @@ -10,7 +10,7 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\Query\QueryFactory; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element; use Drupal\menu_link\MenuLinkStorageInterface; use Drupal\menu_link\MenuTreeInterface; @@ -117,7 +117,7 @@ public function form(array $form, array &$form_state) { $form['langcode'] = array( '#type' => 'language_select', '#title' => t('Menu language'), - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#default_value' => $menu->langcode, ); // Unlike the menu langcode, the default language configuration for menu only in patch2: unchanged: --- a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/MachineName.php +++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/MachineName.php @@ -7,7 +7,7 @@ namespace Drupal\migrate\Plugin\migrate\process; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\MigrateExecutable; use Drupal\migrate\Row; @@ -34,7 +34,7 @@ class MachineName extends ProcessPluginBase { * {@inheritdoc} */ public function transform($value, MigrateExecutable $migrate_executable, Row $row, $destination_property) { - $new_value = $this->getTransliteration()->transliterate($value, Language::LANGCODE_DEFAULT, '_'); + $new_value = $this->getTransliteration()->transliterate($value, LanguageInterface::LANGCODE_DEFAULT, '_'); $new_value = strtolower($new_value); $new_value = preg_replace('/[^a-z0-9_]+/', '_', $new_value); return preg_replace('/_+/', '_', $new_value); only in patch2: unchanged: --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php @@ -8,7 +8,7 @@ namespace Drupal\migrate_drupal\Tests\d6; use Drupal\aggregator\Entity\Feed; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\migrate\MigrateExecutable; use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase; @@ -49,7 +49,7 @@ public function testAggregatorFeedImport() { $feed = entity_load('aggregator_feed', 5); $this->assertNotNull($feed->uuid()); $this->assertEqual($feed->title->value, 'Know Your Meme'); - $this->assertEqual($feed->language()->id, Language::LANGCODE_NOT_SPECIFIED); + $this->assertEqual($feed->language()->id, LanguageInterface::LANGCODE_NOT_SPECIFIED); $this->assertEqual($feed->url->value, 'http://knowyourmeme.com/newsfeed.rss'); $this->assertEqual($feed->refresh->value, 900); $this->assertEqual($feed->checked->value, 1387659487); only in patch2: unchanged: --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php @@ -8,7 +8,7 @@ namespace Drupal\migrate_drupal\Tests\d6; use Drupal\aggregator\Entity\Item; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\migrate\MigrateExecutable; use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase; @@ -76,7 +76,7 @@ public function testAggregatorItem() { $this->assertEqual($item->getDescription(), "

What's new with Drupal 8?

"); $this->assertEqual($item->getLink(), 'https://groups.drupal.org/node/395218'); $this->assertEqual($item->getPostedTime(), 1389297196); - $this->assertEqual($item->language()->id, Language::LANGCODE_NOT_SPECIFIED); + $this->assertEqual($item->language()->id, LanguageInterface::LANGCODE_NOT_SPECIFIED); $this->assertEqual($item->getGuid(), '395218 at https://groups.drupal.org'); } only in patch2: unchanged: --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php @@ -8,7 +8,7 @@ namespace Drupal\migrate_drupal\Tests\d6; use Drupal\comment\Entity\Comment; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\migrate\MigrateExecutable; use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase; @@ -76,7 +76,7 @@ public function testComments() { $this->assertEqual(0, $comment->pid->value); $this->assertEqual(1, $comment->entity_id->value); $this->assertEqual('node', $comment->entity_type->value); - $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $comment->language()->id); + $this->assertEqual(LanguageInterface::LANGCODE_NOT_SPECIFIED, $comment->language()->id); $comment = entity_load('comment', 2); $this->assertEqual('The response to the second comment.', $comment->subject->value); only in patch2: unchanged: --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php @@ -7,7 +7,7 @@ namespace Drupal\migrate_drupal\Tests\d6; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\custom_block\Entity\CustomBlock; use Drupal\migrate\MigrateExecutable; use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase; @@ -59,7 +59,7 @@ public function testBlockMigration() { $this->assertEqual('My block 1', $block->label()); $this->assertEqual(1, $block->getRevisionId()); $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time()); - $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $block->language()->id); + $this->assertEqual(LanguageInterface::LANGCODE_NOT_SPECIFIED, $block->language()->id); $this->assertEqual('

My custom block body

', $block->body->value); $this->assertEqual('full_html', $block->body->format); } only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/NodeAccessController.php +++ b/core/modules/node/lib/Drupal/node/NodeAccessController.php @@ -11,7 +11,7 @@ use Drupal\Core\Database\Query\SelectInterface; use Drupal\Core\Entity\EntityControllerInterface; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Entity\EntityAccessController; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\ContentEntityBase; @@ -58,7 +58,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI /** * {@inheritdoc} */ - public function access(EntityInterface $entity, $operation, $langcode = Language::LANGCODE_DEFAULT, AccountInterface $account = NULL) { + public function access(EntityInterface $entity, $operation, $langcode = LanguageInterface::LANGCODE_DEFAULT, AccountInterface $account = NULL) { if (user_access('bypass node access', $account)) { return TRUE; } only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/NodeForm.php +++ b/core/modules/node/lib/Drupal/node/NodeForm.php @@ -11,7 +11,7 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Entity\ContentEntityForm; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Component\Utility\String; /** @@ -90,7 +90,7 @@ public function form(array $form, array &$form_state) { '#title' => t('Language'), '#type' => 'language_select', '#default_value' => $node->getUntranslated()->language()->id, - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#access' => isset($language_configuration['language_show']) && $language_configuration['language_show'], ); only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/NodeListBuilder.php +++ b/core/modules/node/lib/Drupal/node/NodeListBuilder.php @@ -13,7 +13,7 @@ use Drupal\Core\Entity\EntityListBuilder; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -99,7 +99,7 @@ public function buildRow(EntityInterface $entity) { $langcode = $entity->language()->id; $uri = $entity->urlInfo(); $options = $uri->getOptions(); - $options += ($langcode != Language::LANGCODE_NOT_SPECIFIED && isset($languages[$langcode]) ? array('language' => $languages[$langcode]) : array()); + $options += ($langcode != LanguageInterface::LANGCODE_NOT_SPECIFIED && isset($languages[$langcode]) ? array('language' => $languages[$langcode]) : array()); $uri->setOptions($options); $row['title']['data'] = array( '#type' => 'link', only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php @@ -82,7 +82,7 @@ function testNodeAccess() { // Creating a public node with no special langcode, like when no language // module enabled. $node_public_no_language = $this->drupalCreateNode(array('private' => FALSE)); - $this->assertTrue($node_public_no_language->language()->id == Language::LANGCODE_NOT_SPECIFIED, 'Node created with not specified language.'); + $this->assertTrue($node_public_no_language->language()->id == LanguageInterface::LANGCODE_NOT_SPECIFIED, 'Node created with not specified language.'); // Tests that access is granted if requested with no language. $this->assertNodeAccess($expected_node_access, $node_public_no_language, $web_user); @@ -172,7 +172,7 @@ function testNodeAccessPrivate() { // Creating a private node with no special langcode, like when no language // module enabled. $node_private_no_language = $this->drupalCreateNode(array('private' => TRUE)); - $this->assertTrue($node_private_no_language->language()->id == Language::LANGCODE_NOT_SPECIFIED, 'Node created with not specified language.'); + $this->assertTrue($node_private_no_language->language()->id == LanguageInterface::LANGCODE_NOT_SPECIFIED, 'Node created with not specified language.'); // Tests that access is not granted if requested with no language. $this->assertNodeAccess($expected_node_access_no_access, $node_private_no_language, $web_user); @@ -245,7 +245,7 @@ function testNodeAccessQueryTag() { // Creating a public node with no special langcode, like when no language // module enabled. $node_no_language = $this->drupalCreateNode(array('private' => FALSE)); - $this->assertTrue($node_no_language->language()->id == Language::LANGCODE_NOT_SPECIFIED, 'Node created with not specified language.'); + $this->assertTrue($node_no_language->language()->id == LanguageInterface::LANGCODE_NOT_SPECIFIED, 'Node created with not specified language.'); // Query the nodes table as the web user with the node access tag and no // specific langcode. only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php @@ -7,7 +7,6 @@ namespace Drupal\node\Tests; -use Drupal\Core\Language\Language; use Drupal\comment\CommentInterface; use Drupal\simpletest\WebTestBase; only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php @@ -8,7 +8,7 @@ namespace Drupal\node\Tests; use Drupal\Core\Database\Database; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests creating and saving a node. @@ -84,7 +84,7 @@ function testFailedPageCreation() { 'uid' => $this->loggedInUser->id(), 'name' => $this->loggedInUser->name, 'type' => 'page', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'title' => 'testing_transaction_exception', ); only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php @@ -100,7 +100,7 @@ function testMultilingualNodeForm() { $this->assertTrue($node->language()->id == $langcode && $node->body->value == $body_value, 'Field language correctly changed.'); // Enable content language URL detection. - $this->container->get('language_negotiator')->saveConfiguration(Language::TYPE_CONTENT, array(LanguageNegotiationUrl::METHOD_ID => 0)); + $this->container->get('language_negotiator')->saveConfiguration(LanguageInterface::TYPE_CONTENT, array(LanguageNegotiationUrl::METHOD_ID => 0)); // Test multilingual field language fallback logic. $this->drupalGet("it/node/{$node->id()}"); only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php @@ -7,8 +7,6 @@ namespace Drupal\node\Tests; -use Drupal\Core\Language\Language; - /** * Tests actions against revisions for user with access to all revisions. */ only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php @@ -7,8 +7,6 @@ namespace Drupal\node\Tests; -use Drupal\Core\Language\Language; - /** * Tests the node revision functionality. */ only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php @@ -7,7 +7,7 @@ namespace Drupal\node\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests the node entity preview functionality. @@ -47,7 +47,7 @@ function setUp() { 'name' => $this->randomName(), 'description' => $this->randomName(), 'vid' => $this->randomName(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'help' => '', )); $vocabulary->save(); @@ -59,7 +59,7 @@ function setUp() { 'name' => $this->randomName(), 'description' => $this->randomName(), 'vid' => $this->vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term->save(); only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/Tests/Views/RowPluginTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/Views/RowPluginTest.php @@ -7,7 +7,6 @@ namespace Drupal\node\Tests\Views; -use Drupal\Core\Language\Language; use Drupal\views\Views; /** only in patch2: unchanged: --- a/core/modules/node/node.admin.inc +++ b/core/modules/node/node.admin.inc @@ -5,7 +5,6 @@ * Content administration and module settings user interface. */ -use Drupal\Core\Language\Language; use Drupal\node\NodeInterface; /** only in patch2: unchanged: --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -6,7 +6,6 @@ */ use Drupal\Component\Uuid\Uuid; -use Drupal\Core\Language\Language; /** * Implements hook_requirements(). only in patch2: unchanged: --- a/core/modules/node/node.tokens.inc +++ b/core/modules/node/node.tokens.inc @@ -5,7 +5,7 @@ * Builds placeholder replacement tokens for node-related data. */ -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Implements hook_token_info(). @@ -94,7 +94,7 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr $langcode = $options['langcode']; } else { - $langcode = Language::LANGCODE_DEFAULT; + $langcode = LanguageInterface::LANGCODE_DEFAULT; } $sanitize = !empty($options['sanitize']); only in patch2: unchanged: --- a/core/modules/path/lib/Drupal/path/Form/AddForm.php +++ b/core/modules/path/lib/Drupal/path/Form/AddForm.php @@ -7,7 +7,7 @@ namespace Drupal\path\Form; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Provides the path add form. @@ -28,7 +28,7 @@ protected function buildPath($pid) { return array( 'source' => '', 'alias' => '', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'pid' => NULL, ); } only in patch2: unchanged: --- a/core/modules/path/lib/Drupal/path/Form/PathFormBase.php +++ b/core/modules/path/lib/Drupal/path/Form/PathFormBase.php @@ -8,7 +8,7 @@ namespace Drupal\path\Form; use Drupal\Core\Form\FormBase; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Path\AliasManagerInterface; use Drupal\Core\Path\AliasStorageInterface; use Drupal\Core\Url; @@ -109,7 +109,7 @@ public function buildForm(array $form, array &$form_state, $pid = NULL) { '#type' => 'select', '#title' => $this->t('Language'), '#options' => $language_options, - '#empty_value' => Language::LANGCODE_NOT_SPECIFIED, + '#empty_value' => LanguageInterface::LANGCODE_NOT_SPECIFIED, '#empty_option' => $this->t('- None -'), '#default_value' => $this->path['langcode'], '#weight' => -10, @@ -141,7 +141,7 @@ public function validateForm(array &$form, array &$form_state) { $alias = $form_state['values']['alias']; // Language is only set if language.module is enabled, otherwise save for all // languages. - $langcode = isset($form_state['values']['langcode']) ? $form_state['values']['langcode'] : Language::LANGCODE_NOT_SPECIFIED; + $langcode = isset($form_state['values']['langcode']) ? $form_state['values']['langcode'] : LanguageInterface::LANGCODE_NOT_SPECIFIED; if ($this->aliasStorage->aliasExists($alias, $langcode, $source)) { $this->setFormError('alias', $form_state, t('The alias %alias is already in use in this language.', array('%alias' => $alias))); @@ -164,7 +164,7 @@ public function submitForm(array &$form, array &$form_state) { $alias = $form_state['values']['alias']; // Language is only set if language.module is enabled, otherwise save for all // languages. - $langcode = isset($form_state['values']['langcode']) ? $form_state['values']['langcode'] : Language::LANGCODE_NOT_SPECIFIED; + $langcode = isset($form_state['values']['langcode']) ? $form_state['values']['langcode'] : LanguageInterface::LANGCODE_NOT_SPECIFIED; $this->aliasStorage->save($source, $alias, $langcode, $pid); only in patch2: unchanged: --- a/core/modules/path/lib/Drupal/path/Plugin/Field/FieldWidget/PathWidget.php +++ b/core/modules/path/lib/Drupal/path/Plugin/Field/FieldWidget/PathWidget.php @@ -9,7 +9,7 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\WidgetBase; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\Validator\ConstraintViolationInterface; /** @@ -33,7 +33,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen $path = array(); if (!$entity->isNew()) { $conditions = array('source' => $entity->getSystemPath()); - if ($items->getLangcode() != Language::LANGCODE_NOT_SPECIFIED) { + if ($items->getLangcode() != LanguageInterface::LANGCODE_NOT_SPECIFIED) { $conditions['langcode'] = $items->getLangcode(); } $path = \Drupal::service('path.alias_storage')->load($conditions); only in patch2: unchanged: --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -6,7 +6,6 @@ */ use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Language\Language; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Field\FieldDefinition; only in patch2: unchanged: --- a/core/modules/quickedit/lib/Drupal/quickedit/Tests/EditorSelectionTest.php +++ b/core/modules/quickedit/lib/Drupal/quickedit/Tests/EditorSelectionTest.php @@ -7,7 +7,7 @@ namespace Drupal\quickedit\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\quickedit\Plugin\InPlaceEditorManager; use Drupal\quickedit\EditorSelector; @@ -50,7 +50,7 @@ protected function setUp() { */ protected function getSelectedEditor($entity_id, $field_name, $view_mode = 'default') { $entity = entity_load('entity_test', $entity_id, TRUE); - $items = $entity->getTranslation(Language::LANGCODE_NOT_SPECIFIED)->get($field_name); + $items = $entity->getTranslation(LanguageInterface::LANGCODE_NOT_SPECIFIED)->get($field_name); $options = entity_get_display('entity_test', 'entity_test', $view_mode)->getComponent($field_name); return $this->editorSelector->getEditor($options['type'], $items); } only in patch2: unchanged: --- a/core/modules/quickedit/lib/Drupal/quickedit/Tests/MetadataGeneratorTest.php +++ b/core/modules/quickedit/lib/Drupal/quickedit/Tests/MetadataGeneratorTest.php @@ -7,7 +7,7 @@ namespace Drupal\quickedit\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\quickedit\EditorSelector; use Drupal\quickedit\MetadataGenerator; use Drupal\quickedit\Plugin\InPlaceEditorManager; @@ -102,7 +102,7 @@ public function testSimpleEntityType() { $entity = entity_load('entity_test', $this->entity->id()); // Verify metadata for field 1. - $items_1 = $entity->getTranslation(Language::LANGCODE_NOT_SPECIFIED)->get($field_1_name); + $items_1 = $entity->getTranslation(LanguageInterface::LANGCODE_NOT_SPECIFIED)->get($field_1_name); $metadata_1 = $this->metadataGenerator->generateFieldMetadata($items_1, 'default'); $expected_1 = array( 'access' => TRUE, @@ -113,7 +113,7 @@ public function testSimpleEntityType() { $this->assertEqual($expected_1, $metadata_1, 'The correct metadata is generated for the first field.'); // Verify metadata for field 2. - $items_2 = $entity->getTranslation(Language::LANGCODE_NOT_SPECIFIED)->get($field_2_name); + $items_2 = $entity->getTranslation(LanguageInterface::LANGCODE_NOT_SPECIFIED)->get($field_2_name); $metadata_2 = $this->metadataGenerator->generateFieldMetadata($items_2, 'default'); $expected_2 = array( 'access' => TRUE, @@ -175,7 +175,7 @@ public function testEditorWithCustomMetadata() { $entity = entity_load('entity_test', $this->entity->id()); // Verify metadata. - $items = $entity->getTranslation(Language::LANGCODE_NOT_SPECIFIED)->get($field_name); + $items = $entity->getTranslation(LanguageInterface::LANGCODE_NOT_SPECIFIED)->get($field_name); $metadata = $this->metadataGenerator->generateFieldMetadata($items, 'default'); $expected = array( 'access' => TRUE, only in patch2: unchanged: --- a/core/modules/quickedit/lib/Drupal/quickedit/Tests/QuickEditAutocompleteTermTest.php +++ b/core/modules/quickedit/lib/Drupal/quickedit/Tests/QuickEditAutocompleteTermTest.php @@ -9,7 +9,7 @@ use Drupal\Component\Serialization\Json; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -211,7 +211,7 @@ protected function createTerm() { // Use the first available text format. 'format' => $format->format, 'vid' => $this->vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term->save(); return $term; only in patch2: unchanged: --- a/core/modules/quickedit/tests/Drupal/quickedit/Tests/Access/EditEntityFieldAccessCheckTest.php +++ b/core/modules/quickedit/tests/Drupal/quickedit/Tests/Access/EditEntityFieldAccessCheckTest.php @@ -13,7 +13,7 @@ use Drupal\quickedit\Access\EditEntityFieldAccessCheck; use Drupal\Tests\UnitTestCase; use Drupal\field\FieldConfigInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Entity\EntityInterface; /** @@ -128,14 +128,14 @@ public function testAccess(EntityInterface $entity, FieldConfigInterface $field ->will($this->returnValue($field)); $entity_with_field->expects($this->once()) ->method('hasTranslation') - ->with(Language::LANGCODE_NOT_SPECIFIED) + ->with(LanguageInterface::LANGCODE_NOT_SPECIFIED) ->will($this->returnValue(TRUE)); // Prepare the request to be valid. $request->attributes->set('entity_type', 'test_entity'); $request->attributes->set('entity', $entity_with_field); $request->attributes->set('field_name', 'valid'); - $request->attributes->set('langcode', Language::LANGCODE_NOT_SPECIFIED); + $request->attributes->set('langcode', LanguageInterface::LANGCODE_NOT_SPECIFIED); $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $access = $this->editAccessCheck->access($route, $request, $account); only in patch2: unchanged: --- a/core/modules/quickedit/tests/modules/quickedit_test.module +++ b/core/modules/quickedit/tests/modules/quickedit_test.module @@ -5,7 +5,7 @@ * Helper module for the Quick Edit tests. */ -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; @@ -21,7 +21,7 @@ function quickedit_test_entity_view_alter(&$build, EntityInterface $entity, Enti '#label_display' => 'Label', '#entity_type' => $entity->getEntityTypeId(), '#bundle' => $entity->bundle(), - '#language' => Language::LANGCODE_NOT_SPECIFIED, + '#language' => LanguageInterface::LANGCODE_NOT_SPECIFIED, '#field_type' => 'pseudo', '#view_mode' => 'default', '#object' => $entity, only in patch2: unchanged: --- a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/TaxonomyTermReferenceRdfaTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/TaxonomyTermReferenceRdfaTest.php @@ -8,7 +8,7 @@ use Drupal\rdf\Tests\Field\FieldRdfaTestBase; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests the RDFa output of the taxonomy term reference field formatter. @@ -55,7 +55,7 @@ public function setUp() { $vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $vocabulary->save(); @@ -82,7 +82,7 @@ public function setUp() { $this->term = entity_create('taxonomy_term', array( 'name' => $this->randomName(), 'vid' => $vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $this->term->save(); only in patch2: unchanged: --- a/core/modules/rdf/lib/Drupal/rdf/Tests/FileFieldAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/FileFieldAttributesTest.php @@ -7,7 +7,6 @@ namespace Drupal\rdf\Tests; -use Drupal\Core\Language\Language; use Drupal\file\Tests\FileFieldTestBase; /** only in patch2: unchanged: --- a/core/modules/rdf/lib/Drupal/rdf/Tests/ImageFieldAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/ImageFieldAttributesTest.php @@ -7,7 +7,6 @@ namespace Drupal\rdf\Tests; -use Drupal\Core\Language\Language; use Drupal\image\Tests\ImageFieldTestBase; /** only in patch2: unchanged: --- a/core/modules/responsive_image/lib/Drupal/responsive_image/Tests/ResponsiveImageFieldDisplayTest.php +++ b/core/modules/responsive_image/lib/Drupal/responsive_image/Tests/ResponsiveImageFieldDisplayTest.php @@ -7,7 +7,6 @@ namespace Drupal\responsive_image\Tests; -use Drupal\Core\Language\Language; use Drupal\breakpoint\Entity\Breakpoint; use Drupal\image\Tests\ImageFieldTestBase; only in patch2: unchanged: --- a/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php @@ -8,7 +8,6 @@ namespace Drupal\rest\Tests; use Drupal\Component\Serialization\Json; -use Drupal\Core\Language\Language; use Drupal\rest\Tests\RESTTestBase; /** only in patch2: unchanged: --- a/core/modules/search/lib/Drupal/search/Tests/SearchMatchTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchMatchTest.php @@ -7,7 +7,7 @@ namespace Drupal\search\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; // The search index can contain different types of content. Typically the type // is 'node'. Here we test with _test_ and _test2_ as the type. @@ -42,10 +42,10 @@ function _setup() { \Drupal::config('search.settings')->set('index.minimum_word_size', 3)->save(); for ($i = 1; $i <= 7; ++$i) { - search_index($i, SEARCH_TYPE, $this->getText($i), Language::LANGCODE_NOT_SPECIFIED); + search_index($i, SEARCH_TYPE, $this->getText($i), LanguageInterface::LANGCODE_NOT_SPECIFIED); } for ($i = 1; $i <= 5; ++$i) { - search_index($i + 7, SEARCH_TYPE_2, $this->getText2($i), Language::LANGCODE_NOT_SPECIFIED); + search_index($i + 7, SEARCH_TYPE_2, $this->getText2($i), LanguageInterface::LANGCODE_NOT_SPECIFIED); } // No getText builder function for Japanese text; just a simple array. foreach (array( @@ -53,7 +53,7 @@ function _setup() { 14 => 'ドルーパルが大好きよ!', 15 => 'コーヒーとケーキ', ) as $i => $jpn) { - search_index($i, SEARCH_TYPE_JPN, $jpn, Language::LANGCODE_NOT_SPECIFIED); + search_index($i, SEARCH_TYPE_JPN, $jpn, LanguageInterface::LANGCODE_NOT_SPECIFIED); } search_update_totals(); } only in patch2: unchanged: --- a/core/modules/search/lib/Drupal/search/Tests/SearchNumberMatchingTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchNumberMatchingTest.php @@ -7,7 +7,7 @@ namespace Drupal\search\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests that various number formats match each other in searching. @@ -49,7 +49,7 @@ function setUp() { $info = array( 'body' => array(array('value' => $num)), 'type' => 'page', - 'language' => Language::LANGCODE_NOT_SPECIFIED, + 'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); $this->nodes[] = $this->drupalCreateNode($info); } only in patch2: unchanged: --- a/core/modules/search/lib/Drupal/search/Tests/SearchNumbersTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchNumbersTest.php @@ -7,7 +7,7 @@ namespace Drupal\search\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests that numbers with different formats can be searched. @@ -55,7 +55,7 @@ function setUp() { $info = array( 'body' => array(array('value' => $num)), 'type' => 'page', - 'language' => Language::LANGCODE_NOT_SPECIFIED, + 'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'title' => $doc . ' number', ); $this->nodes[$doc] = $this->drupalCreateNode($info); only in patch2: unchanged: --- a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php +++ b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php @@ -7,7 +7,7 @@ namespace Drupal\serialization\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\Serializer\Serializer; use Drupal\Component\Utility\String; @@ -87,7 +87,7 @@ public function testNormalize() { array('value' => $this->entity->uuid()), ), 'langcode' => array( - array('value' => Language::LANGCODE_NOT_SPECIFIED), + array('value' => LanguageInterface::LANGCODE_NOT_SPECIFIED), ), 'default_langcode' => array( array('value' => NULL), @@ -143,7 +143,7 @@ public function testSerialize() { 'id' => '' . $this->entity->id() . '', 'revision_id' => '' . $this->entity->getRevisionId() . '', 'uuid' => '' . $this->entity->uuid() . '', - 'langcode' => '' . Language::LANGCODE_NOT_SPECIFIED . '', + 'langcode' => '' . LanguageInterface::LANGCODE_NOT_SPECIFIED . '', 'default_langcode' => '', 'name' => '' . $this->values['name'] . '', 'type' => 'entity_test_mulrev', only in patch2: unchanged: --- a/core/modules/shortcut/shortcut.install +++ b/core/modules/shortcut/shortcut.install @@ -6,7 +6,6 @@ */ use Drupal\Core\Database\Database; -use Drupal\Core\Language\Language; /** * Implements hook_schema(). only in patch2: unchanged: --- a/core/modules/shortcut/src/ShortcutForm.php +++ b/core/modules/shortcut/src/ShortcutForm.php @@ -8,7 +8,7 @@ namespace Drupal\shortcut; use Drupal\Core\Entity\ContentEntityForm; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Form controller for the shortcut entity forms. @@ -41,7 +41,7 @@ public function form(array $form, array &$form_state) { '#title' => t('Language'), '#type' => 'language_select', '#default_value' => $this->entity->getUntranslated()->language()->id, - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, ); return $form; only in patch2: unchanged: --- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php @@ -10,7 +10,7 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DrupalKernel; use Drupal\Core\KeyValueStore\KeyValueMemoryFactory; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\DependencyInjection\Reference; use Drupal\Core\Database\Database; use Symfony\Component\HttpFoundation\Request; @@ -222,7 +222,7 @@ public function containerBuild(ContainerBuilder $container) { $this->container = $container; // Set the default language on the minimal container. - $this->container->setParameter('language.default_values', Language::$defaultValues); + $this->container->setParameter('language.default_values', LanguageInterface::$defaultValues); $container->register('lock', 'Drupal\Core\Lock\NullLockBackend'); $container->register('cache_factory', 'Drupal\Core\Cache\MemoryBackendFactory'); only in patch2: unchanged: --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -16,7 +16,7 @@ use Drupal\Core\Database\ConnectionNotDefinedException; use Drupal\Core\Config\StorageInterface; use Drupal\Core\DrupalKernel; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountProxy; use Drupal\Core\Session\AnonymousUserSession; use Drupal\Core\Site\Settings; @@ -1071,7 +1071,7 @@ private function prepareEnvironment() { $this->container = new ContainerBuilder(); // @todo Remove this once this class has no calls to t() and format_plural() - $this->container->setParameter('language.default_values', Language::$defaultValues); + $this->container->setParameter('language.default_values', LanguageInterface::$defaultValues); $this->container->register('language.default', 'Drupal\Core\Language\LanguageDefault') ->addArgument('%language.default_values%'); $this->container->register('language_manager', 'Drupal\Core\Language\LanguageManager') only in patch2: unchanged: --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -16,7 +16,7 @@ use Drupal\Core\Database\Database; use Drupal\Core\Database\ConnectionNotDefinedException; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AnonymousUserSession; use Drupal\Core\Session\UserSession; @@ -251,7 +251,7 @@ function drupalGetNodeByTitle($title, $reset = FALSE) { * - status: NODE_PUBLISHED. * - sticky: NODE_NOT_STICKY. * - type: 'page'. - * - langcode: Language::LANGCODE_NOT_SPECIFIED. + * - langcode: LanguageInterface::LANGCODE_NOT_SPECIFIED. * - uid: The currently logged in user, or the user running test. * - revision: 1. (Backwards-compatible binary flag indicating whether a * new revision should be created; use 1 to specify a new revision.) @@ -270,7 +270,7 @@ protected function drupalCreateNode(array $settings = array()) { 'status' => NODE_PUBLISHED, 'sticky' => NODE_NOT_STICKY, 'type' => 'page', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); // Use the original node's created time for existing nodes. only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php +++ b/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php @@ -11,7 +11,7 @@ use Drupal\Core\Ajax\ReplaceCommand; use Drupal\Core\Config\Entity\ConfigEntityStorageInterface; use Drupal\Core\Datetime\Date; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Entity\EntityForm; @@ -160,7 +160,7 @@ public function form(array $form, array &$form_state) { $form['langcode'] = array( '#type' => 'language_select', '#title' => t('Language'), - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#default_value' => $this->entity->langcode, ); only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php @@ -8,7 +8,7 @@ namespace Drupal\system\Tests\Entity; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Database\Database; /** @@ -148,7 +148,7 @@ public function testCommentHooks() { 'status' => 1, 'promote' => 0, 'sticky' => 0, - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'created' => REQUEST_TIME, 'changed' => REQUEST_TIME, )); @@ -167,7 +167,7 @@ public function testCommentHooks() { 'created' => REQUEST_TIME, 'changed' => REQUEST_TIME, 'status' => 1, - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $this->assertHookMessageOrder(array( @@ -292,7 +292,7 @@ public function testNodeHooks() { 'status' => 1, 'promote' => 0, 'sticky' => 0, - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'created' => REQUEST_TIME, 'changed' => REQUEST_TIME, )); @@ -351,7 +351,7 @@ public function testTaxonomyTermHooks() { $vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => 'Test vocabulary', 'vid' => 'test', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'description' => NULL, 'module' => 'entity_crud_hook_test', )); @@ -361,7 +361,7 @@ public function testTaxonomyTermHooks() { $term = entity_create('taxonomy_term', array( 'vid' => $vocabulary->id(), 'name' => 'Test term', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'description' => NULL, 'format' => 1, )); @@ -420,7 +420,7 @@ public function testTaxonomyVocabularyHooks() { $vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => 'Test vocabulary', 'vid' => 'test', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'description' => NULL, 'module' => 'entity_crud_hook_test', )); only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldDefaultValueTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldDefaultValueTest.php @@ -7,7 +7,7 @@ namespace Drupal\system\Tests\Entity; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Component\Uuid\Uuid; use Drupal\Component\Utility\String; @@ -55,7 +55,7 @@ public function testDefaultValues() { */ protected function assertDefaultValues($entity_type) { $entity = entity_create($entity_type); - $this->assertEqual($entity->langcode->value, Language::LANGCODE_NOT_SPECIFIED, String::format('%entity_type: Default language', array('%entity_type' => $entity_type))); + $this->assertEqual($entity->langcode->value, LanguageInterface::LANGCODE_NOT_SPECIFIED, String::format('%entity_type: Default language', array('%entity_type' => $entity_type))); $this->assertTrue(Uuid::isValid($entity->uuid->value), String::format('%entity_type: Default UUID', array('%entity_type' => $entity_type))); $this->assertEqual($entity->name->getValue(), array(0 => array('value' => NULL)), 'Field has one empty value by default.'); } only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php @@ -12,7 +12,7 @@ use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\TypedData\ComplexDataDefinitionInterface; use Drupal\Core\TypedData\DataDefinitionInterface; use Drupal\Core\TypedData\Type\StringInterface; @@ -189,8 +189,8 @@ protected function assertReadWrite($entity_type) { $this->assertFalse(isset($entity->name->value), format_string('%entity_type: Name is not set.', array('%entity_type' => $entity_type))); // Access the language field. - $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $entity->langcode->value, format_string('%entity_type: Language code can be read.', array('%entity_type' => $entity_type))); - $this->assertEqual(\Drupal::languageManager()->getLanguage(Language::LANGCODE_NOT_SPECIFIED), $entity->langcode->language, format_string('%entity_type: Language object can be read.', array('%entity_type' => $entity_type))); + $this->assertEqual(LanguageInterface::LANGCODE_NOT_SPECIFIED, $entity->langcode->value, format_string('%entity_type: Language code can be read.', array('%entity_type' => $entity_type))); + $this->assertEqual(\Drupal::languageManager()->getLanguage(LanguageInterface::LANGCODE_NOT_SPECIFIED), $entity->langcode->language, format_string('%entity_type: Language object can be read.', array('%entity_type' => $entity_type))); // Change the language by code. $entity->langcode->value = \Drupal::languageManager()->getDefaultLanguage()->id; @@ -198,7 +198,7 @@ protected function assertReadWrite($entity_type) { $this->assertEqual(\Drupal::languageManager()->getDefaultLanguage(), $entity->langcode->language, format_string('%entity_type: Language object can be read.', array('%entity_type' => $entity_type))); // Revert language by code then try setting it by language object. - $entity->langcode->value = Language::LANGCODE_NOT_SPECIFIED; + $entity->langcode->value = LanguageInterface::LANGCODE_NOT_SPECIFIED; $entity->langcode->language = \Drupal::languageManager()->getDefaultLanguage(); $this->assertEqual(\Drupal::languageManager()->getDefaultLanguage()->id, $entity->langcode->value, format_string('%entity_type: Language code can be read.', array('%entity_type' => $entity_type))); $this->assertEqual(\Drupal::languageManager()->getDefaultLanguage(), $entity->langcode->language, format_string('%entity_type: Language object can be read.', array('%entity_type' => $entity_type))); @@ -328,8 +328,8 @@ protected function assertSave($entity_type) { // Access the name field. $this->assertEqual(1, $entity->id->value, format_string('%entity_type: ID value can be read.', array('%entity_type' => $entity_type))); $this->assertTrue(is_string($entity->uuid->value), format_string('%entity_type: UUID value can be read.', array('%entity_type' => $entity_type))); - $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $entity->langcode->value, format_string('%entity_type: Language code can be read.', array('%entity_type' => $entity_type))); - $this->assertEqual(\Drupal::languageManager()->getLanguage(Language::LANGCODE_NOT_SPECIFIED), $entity->langcode->language, format_string('%entity_type: Language object can be read.', array('%entity_type' => $entity_type))); + $this->assertEqual(LanguageInterface::LANGCODE_NOT_SPECIFIED, $entity->langcode->value, format_string('%entity_type: Language code can be read.', array('%entity_type' => $entity_type))); + $this->assertEqual(\Drupal::languageManager()->getLanguage(LanguageInterface::LANGCODE_NOT_SPECIFIED), $entity->langcode->language, format_string('%entity_type: Language object can be read.', array('%entity_type' => $entity_type))); $this->assertEqual($this->entity_user->id(), $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type))); $this->assertEqual($this->entity_user->getUsername(), $entity->user_id->entity->name->value, format_string('%entity_type: User name can be read.', array('%entity_type' => $entity_type))); $this->assertEqual($this->entity_field_text, $entity->field_test_text->value, format_string('%entity_type: Text field can be read.', array('%entity_type' => $entity_type))); @@ -503,7 +503,7 @@ protected function assertDataStructureInterfaces($entity_type) { // the user name and other user entity strings as well. $target_strings = array( $entity->uuid->value, - Language::LANGCODE_NOT_SPECIFIED, + LanguageInterface::LANGCODE_NOT_SPECIFIED, $this->entity_name, // Bundle name. $entity->bundle(), only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldTranslationSqlStorageTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldTranslationSqlStorageTest.php @@ -9,7 +9,7 @@ use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\ContentEntityDatabaseStorage; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\field\Field as FieldService; /** @@ -48,7 +48,7 @@ public function testFieldSqlStorage() { $entity->langcode->value = $langcode; $entity->save(); $this->assertFieldStorageLangcode($entity, 'Field language successfully changed.'); - $langcode = Language::LANGCODE_NOT_SPECIFIED; + $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; $entity->langcode->value = $langcode; $entity->save(); $this->assertFieldStorageLangcode($entity, 'Field language successfully changed to language neutral.'); only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php @@ -52,10 +52,10 @@ function testLanguageSelectElementOptions() { $this->drupalGet('form-test/language_select'); // Check that the language fields were rendered on the page. - $ids = array('edit-languages-all' => Language::STATE_ALL, - 'edit-languages-configurable' => Language::STATE_CONFIGURABLE, - 'edit-languages-locked' => Language::STATE_LOCKED, - 'edit-languages-config-and-locked' => Language::STATE_CONFIGURABLE | Language::STATE_LOCKED); + $ids = array('edit-languages-all' => LanguageInterface::STATE_ALL, + 'edit-languages-configurable' => LanguageInterface::STATE_CONFIGURABLE, + 'edit-languages-locked' => LanguageInterface::STATE_LOCKED, + 'edit-languages-config-and-locked' => LanguageInterface::STATE_CONFIGURABLE | LanguageInterface::STATE_LOCKED); foreach ($ids as $id => $flags) { $this->assertField($id, format_string('The @id field was found on the page.', array('@id' => $id))); $options = array(); @@ -93,7 +93,7 @@ function testHiddenLanguageSelectElement() { $values = Json::decode($this->drupalGetContent()); $this->assertEqual($values['languages_all'], 'xx'); $this->assertEqual($values['languages_configurable'], 'en'); - $this->assertEqual($values['languages_locked'], Language::LANGCODE_NOT_SPECIFIED); + $this->assertEqual($values['languages_locked'], LanguageInterface::LANGCODE_NOT_SPECIFIED); $this->assertEqual($values['languages_config_and_locked'], 'dummy_value'); $this->assertEqual($values['language_custom_options'], 'opt2'); } only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Path/AliasTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Path/AliasTest.php @@ -154,7 +154,7 @@ function testLookupPath() { $aliasStorage->save('user/2', 'bar'); // Hook that clears cache is not executed with unit tests. $aliasManager->cacheClear(); - $this->assertEqual($aliasManager->getSystemPath('bar'), 'user/2', 'Newer alias record is returned when comparing two Language::LANGCODE_NOT_SPECIFIED paths with the same alias.'); + $this->assertEqual($aliasManager->getSystemPath('bar'), 'user/2', 'Newer alias record is returned when comparing two LanguageInterface::LANGCODE_NOT_SPECIFIED paths with the same alias.'); } /** only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php @@ -8,7 +8,6 @@ namespace Drupal\system\Tests\System; use Drupal\simpletest\WebTestBase; -use Drupal\Core\Language\Language; /** * Tests generic date and time handling capabilities of Drupal. only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceUnitTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceUnitTestBase.php @@ -7,7 +7,6 @@ namespace Drupal\system\Tests\System; -use Drupal\Core\Language\Language; use Drupal\system\Tests\Entity\EntityUnitTestBase; /** only in patch2: unchanged: --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -7,7 +7,6 @@ use Drupal\Component\Utility\Crypt; use Drupal\Core\Database\Database; -use Drupal\Core\Language\Language; use Drupal\Core\Site\Settings; use Drupal\Core\StreamWrapper\PublicStream; only in patch2: unchanged: --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php @@ -9,7 +9,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityAccessController; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; /** @@ -22,7 +22,7 @@ class EntityTestAccessController extends EntityAccessController { */ protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) { if ($operation === 'view') { - if ($langcode != Language::LANGCODE_DEFAULT) { + if ($langcode != LanguageInterface::LANGCODE_DEFAULT) { return user_access('view test entity translations', $account); } return user_access('view test entity', $account); only in patch2: unchanged: --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestForm.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestForm.php @@ -7,7 +7,7 @@ namespace Drupal\entity_test; use Drupal\Core\Entity\ContentEntityForm; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Form controller for the test entity edit forms. @@ -45,7 +45,7 @@ public function form(array $form, array &$form_state) { '#title' => t('Language'), '#type' => 'language_select', '#default_value' => $entity->getUntranslated()->language()->id, - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, ); // @todo: Is there a better way to check if an entity type is revisionable? only in patch2: unchanged: --- a/core/modules/system/tests/modules/form_test/form_test.module +++ b/core/modules/system/tests/modules/form_test/form_test.module @@ -7,7 +7,7 @@ use Drupal\Component\Serialization\Json; use Drupal\Core\Database\Database; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\form_test\Callbacks; use Drupal\Core\Datetime\DrupalDateTime; use Symfony\Component\HttpFoundation\JsonResponse; @@ -1000,30 +1000,30 @@ function form_test_language_select() { $form['languages_all'] = array( '#title' => t('Languages: All'), '#type' => 'language_select', - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#default_value' => 'xx', ); $form['languages_configurable'] = array( '#title' => t('Languages: Configurable'), '#type' => 'language_select', - '#languages' => Language::STATE_CONFIGURABLE, + '#languages' => LanguageInterface::STATE_CONFIGURABLE, '#default_value' => 'en', ); $form['languages_locked'] = array( '#title' => t('Languages: Locked'), '#type' => 'language_select', - '#languages' => Language::STATE_LOCKED, + '#languages' => LanguageInterface::STATE_LOCKED, ); $form['languages_config_and_locked'] = array( '#title' => t('Languages: Configurable and locked'), '#type' => 'language_select', - '#languages' => Language::STATE_CONFIGURABLE | Language::STATE_LOCKED, + '#languages' => LanguageInterface::STATE_CONFIGURABLE | LanguageInterface::STATE_LOCKED, '#default_value' => 'dummy_value', ); $form['language_custom_options'] = array( '#title' => t('Languages: Custom'), '#type' => 'language_select', - '#languages' => Language::STATE_CONFIGURABLE | Language::STATE_LOCKED, + '#languages' => LanguageInterface::STATE_CONFIGURABLE | LanguageInterface::STATE_LOCKED, '#options' => array('opt1' => 'First option', 'opt2' => 'Second option', 'opt3' => 'Third option'), '#default_value' => 'opt2', ); only in patch2: unchanged: --- a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/Controller/FormTestController.php +++ b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/Controller/FormTestController.php @@ -7,7 +7,7 @@ namespace Drupal\form_test\Controller; use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Controller routines for form_test routes. @@ -26,7 +26,7 @@ public function twoFormInstances() { 'uid' => $user->id(), 'name' => $user->getUsername(), 'type' => 'page', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); $node1 = $this->entityManager()->getStorage('node')->create($values); $node2 = clone($node1); only in patch2: unchanged: --- a/core/modules/system/tests/upgrade/drupal-7.language.database.php +++ b/core/modules/system/tests/upgrade/drupal-7.language.database.php @@ -422,7 +422,7 @@ // Add sample nodes to test language assignment and translation functionality. // The first node is also used for testing comment language functionality. This -// is a simple node with Language::LANGCODE_NOT_SPECIFIED as language code. The second +// is a simple node with LanguageInterface::LANGCODE_NOT_SPECIFIED as language code. The second // node is a Catalan node (language code 'ca'). The third and fourth node are a // translation set with an English source translation (language code 'en') and // a Chuvash translation (language code 'cv'). @@ -545,7 +545,7 @@ 'vid' => '70', 'uid' => '6', 'title' => 'Node title 50', - 'log' => 'Added a Language::LANGCODE_NOT_SPECIFIED node to comment on.', + 'log' => 'Added a LanguageInterface::LANGCODE_NOT_SPECIFIED node to comment on.', 'timestamp' => '1314997642', 'status' => '1', 'comment' => '2', only in patch2: unchanged: --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php @@ -11,7 +11,6 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldDefinition; -use Drupal\Core\Language\Language; use Drupal\Core\TypedData\DataDefinition; use Drupal\taxonomy\TermInterface; only in patch2: unchanged: --- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermForm.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermForm.php @@ -9,7 +9,7 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\ContentEntityForm; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Base for controller for taxonomy term edit forms. @@ -32,7 +32,7 @@ public function form(array $form, array &$form_state) { $form['langcode'] = array( '#type' => 'language_select', '#title' => $this->t('Language'), - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#default_value' => $term->getUntranslated()->language()->id, '#access' => !empty($language_configuration['language_show']), ); only in patch2: unchanged: --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php @@ -10,7 +10,7 @@ use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\field\Tests\FieldUnitTestBase; /** @@ -48,7 +48,7 @@ public function setUp() { $vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $vocabulary->save(); @@ -74,7 +74,7 @@ public function setUp() { $this->term = entity_create('taxonomy_term', array( 'name' => $this->randomName(), 'vid' => $vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $this->term->save(); } @@ -110,7 +110,7 @@ public function testTaxonomyTermReferenceItem() { $term2 = entity_create('taxonomy_term', array( 'name' => $this->randomName(), 'vid' => $this->term->getVocabularyId(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term2->save(); only in patch2: unchanged: --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php @@ -7,7 +7,7 @@ namespace Drupal\taxonomy\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -40,7 +40,7 @@ function createVocabulary() { 'name' => $this->randomName(), 'description' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'weight' => mt_rand(0, 10), )); $vocabulary->save(); @@ -61,7 +61,7 @@ function createTerm($vocabulary) { 'format' => $format->format, ), 'vid' => $vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term->save(); return $term; only in patch2: unchanged: --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php @@ -7,7 +7,7 @@ namespace Drupal\taxonomy\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\content_translation\Tests\ContentTranslationUITest; /** @@ -60,7 +60,7 @@ protected function setupBundle() { 'name' => $this->bundle, 'description' => $this->randomName(), 'vid' => $this->bundle, - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'weight' => mt_rand(0, 10), )); $this->vocabulary->save(); @@ -128,7 +128,7 @@ function testTranslateLinkVocabularyAdminPage() { 'name' => 'untranslatable_voc', 'description' => $this->randomName(), 'vid' => 'untranslatable_voc', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'weight' => mt_rand(0, 10), )); $untranslatable_vocabulary->save(); only in patch2: unchanged: --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php @@ -8,7 +8,7 @@ namespace Drupal\taxonomy\Tests\Views; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\views\Tests\ViewTestBase; use Drupal\views\Tests\ViewTestData; @@ -136,7 +136,7 @@ protected function createTerm() { // Use the first available text format. 'format' => $format->format, 'vid' => $this->vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term->save(); return $term; only in patch2: unchanged: --- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyForm.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyForm.php @@ -9,7 +9,7 @@ use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Base form for vocabulary edit forms. @@ -57,7 +57,7 @@ public function form(array $form, array &$form_state) { $form['langcode'] = array( '#type' => 'language_select', '#title' => $this->t('Vocabulary language'), - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#default_value' => $vocabulary->langcode, ); if ($this->moduleHandler->moduleExists('language')) { only in patch2: unchanged: --- a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php @@ -9,7 +9,7 @@ use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\DrupalUnitTestBase; /** @@ -92,7 +92,7 @@ function setUp() { )); $this->display->save(); - $this->langcode = Language::LANGCODE_NOT_SPECIFIED; + $this->langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; } /** only in patch2: unchanged: --- a/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php @@ -7,7 +7,7 @@ namespace Drupal\text\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemInterface; use Drupal\field\Tests\FieldUnitTestBase; @@ -128,7 +128,7 @@ function testProcessedCache() { $entity = entity_load($entity_type, $entity->id()); $cache = \Drupal::cache('entity')->get("field:$entity_type:" . $entity->id()); $this->assertEqual($cache->data, array( - Language::LANGCODE_NOT_SPECIFIED => array( + LanguageInterface::LANGCODE_NOT_SPECIFIED => array( 'summary_field' => array( 0 => array( 'value' => $value, @@ -144,7 +144,7 @@ function testProcessedCache() { // Inject fake processed values into the cache to make sure that these are // used as-is and not re-calculated when the entity is loaded. $data = array( - Language::LANGCODE_NOT_SPECIFIED => array( + LanguageInterface::LANGCODE_NOT_SPECIFIED => array( 'summary_field' => array( 0 => array( 'value' => $value, only in patch2: unchanged: --- a/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerTestBase.php +++ b/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerTestBase.php @@ -7,7 +7,7 @@ namespace Drupal\tracker\Tests\Views; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\views\Tests\ViewTestBase; use Drupal\views\Tests\ViewTestData; @@ -55,7 +55,7 @@ protected function setUp() { 'entity_type' => 'node', 'field_name' => 'comment', 'subject' => $this->randomName(), - 'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomName(20), + 'comment_body[' . LanguageInterface::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomName(20), )); } only in patch2: unchanged: --- a/core/modules/user/lib/Drupal/user/Plugin/LanguageNegotiation/LanguageNegotiationUserAdmin.php +++ b/core/modules/user/lib/Drupal/user/Plugin/LanguageNegotiation/LanguageNegotiationUserAdmin.php @@ -20,7 +20,7 @@ * * @Plugin( * id = Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUserAdmin::METHOD_ID, - * types = {Drupal\Core\Language\Language::TYPE_INTERFACE}, + * types = {Drupal\Core\Language\LanguageInterface::TYPE_INTERFACE}, * weight = 10, * name = @Translation("Account administration pages"), * description = @Translation("Account administration pages language setting.") only in patch2: unchanged: --- a/core/modules/user/lib/Drupal/user/Tests/UserEntityTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserEntityTest.php @@ -7,7 +7,7 @@ namespace Drupal\user\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\DrupalUnitTestBase; use Drupal\user\Entity\User; @@ -46,7 +46,7 @@ public function testUserMethods() { $role_storage->create(array('id' => 'test_role_two'))->save(); $role_storage->create(array('id' => 'test_role_three'))->save(); - $values = array('roles' => array(Language::LANGCODE_DEFAULT => array('test_role_one'))); + $values = array('roles' => array(LanguageInterface::LANGCODE_DEFAULT => array('test_role_one'))); $user = new User($values, 'user'); $this->assertTrue($user->hasRole('test_role_one')); only in patch2: unchanged: --- a/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php @@ -8,7 +8,6 @@ namespace Drupal\user\Tests; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; class UserRegistrationTest extends WebTestBase { only in patch2: unchanged: --- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php @@ -8,7 +8,7 @@ namespace Drupal\views\Tests; use Drupal\comment\CommentInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; use Drupal\views\ViewExecutable; use Drupal\views\Views; @@ -54,7 +54,7 @@ protected function setUp() { 'name' => $this->randomName(), 'description' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'help' => '', 'nodes' => array('page' => 'page'), 'weight' => mt_rand(0, 10), @@ -164,7 +164,7 @@ function createTerm($vocabulary) { // Use the first available text format. 'format' => $format->format, 'vid' => $vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term->save(); return $term; only in patch2: unchanged: --- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php @@ -8,7 +8,6 @@ namespace Drupal\views\Tests\Handler; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Language\Language; use Drupal\views\Tests\ViewTestBase; use Drupal\views\Views; only in patch2: unchanged: --- a/core/modules/views/lib/Drupal/views/Tests/ViewsTaxonomyAutocompleteTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewsTaxonomyAutocompleteTest.php @@ -9,7 +9,7 @@ use Drupal\Component\Utility\String; use Drupal\views\Tests\ViewTestBase; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests the views taxonomy complete menu callback. @@ -105,7 +105,7 @@ protected function createTerm($name = NULL) { 'name' => $name ?: $this->randomName(), 'description' => $this->randomName(), 'vid' => $this->vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term->save(); return $term; only in patch2: unchanged: --- a/core/modules/views/lib/Drupal/views/ViewAccessController.php +++ b/core/modules/views/lib/Drupal/views/ViewAccessController.php @@ -9,7 +9,6 @@ use Drupal\Core\Entity\EntityAccessController; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; /** only in patch2: unchanged: --- a/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php +++ b/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php @@ -7,7 +7,7 @@ namespace Drupal\views_ui\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Tests\UnitTestCase; use Drupal\views\ViewExecutable; use Drupal\views_ui\ViewUI; @@ -37,7 +37,7 @@ public function testEntityDecoration() { $method_args['setOriginalId'] = array(12); $method_args['setStatus'] = array(TRUE); $method_args['enforceIsNew'] = array(FALSE); - $method_args['label'] = array(Language::LANGCODE_NOT_SPECIFIED); + $method_args['label'] = array(LanguageInterface::LANGCODE_NOT_SPECIFIED); $reflection = new \ReflectionClass('Drupal\Core\Config\Entity\ConfigEntityInterface'); $interface_methods = array(); only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php @@ -236,7 +236,7 @@ public function testAccess() { * @covers ::language */ public function testLanguage() { - $this->assertSame('en', $this->entity->language()->id); + $this->assertSame('en', $this->entity->language()->getId()); } /** only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php @@ -91,9 +91,13 @@ protected function setUp() { $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface'); $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); + $language = $this->getMock('\Drupal\Core\Language\LanguageInterface'); + $language->expects($this->any()) + ->method('getId') + ->will($this->returnValue('en')); $this->languageManager->expects($this->any()) ->method('getCurrentLanguage') - ->will($this->returnValue((object) array('id' => 'en'))); + ->will($this->returnValue($language)); $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'); only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php @@ -8,6 +8,7 @@ namespace Drupal\Tests\Core\Plugin; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Tests\UnitTestCase; /** @@ -143,7 +144,7 @@ public function testDefaultPluginManagerWithEmptyCache() { $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); $language_manager->expects($this->once()) ->method('getCurrentLanguage') - ->with(Language::TYPE_INTERFACE) + ->with(LanguageInterface::TYPE_INTERFACE) ->will($this->returnValue($language)); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); @@ -174,7 +175,7 @@ public function testDefaultPluginManagerWithFilledCache() { $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); $language_manager->expects($this->once()) ->method('getCurrentLanguage') - ->with(Language::TYPE_INTERFACE) + ->with(LanguageInterface::TYPE_INTERFACE) ->will($this->returnValue($language)); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); @@ -205,7 +206,7 @@ public function testCacheClearWithTags() { $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); $language_manager->expects($this->once()) ->method('getCurrentLanguage') - ->with(Language::TYPE_INTERFACE) + ->with(LanguageInterface::TYPE_INTERFACE) ->will($this->returnValue($language)); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Core/Utility/TokenUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/TokenUnitTest.php @@ -7,7 +7,7 @@ namespace Drupal\Tests\Core\Utility; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Utility\Token; use Drupal\Tests\UnitTestCase; @@ -82,12 +82,11 @@ public function testGetInfo() { ), ); - $language = $this->getMock('\Drupal\Core\Language\Language'); - $language->id = $this->randomName(); + $language = $this->getMock('\Drupal\Core\Language\LanguageInterface'); $this->languageManager->expects($this->once()) ->method('getCurrentLanguage') - ->with(Language::TYPE_CONTENT) + ->with(LanguageInterface::TYPE_CONTENT) ->will($this->returnValue($language)); // The persistent cache must only be hit once, after which the info is @@ -96,7 +95,7 @@ public function testGetInfo() { ->method('get'); $this->cache->expects($this->once()) ->method('set') - ->with('token_info:' . $language->id, $token_info); + ->with('token_info:' . $language->getId(), $token_info); $this->moduleHandler->expects($this->once()) ->method('invokeAll')