Follow-up from #2108599: Convert language_default to CMI.


class Language {
   * The values to use to instantiate the default language.
   * @todo Remove once the default language is converted to config. See
   * @var array
  public static $defaultValues = array(
    'id' => 'en',
    'name' => 'English',
    'direction' => 0,
    'weight' => 0,
    'locked' => 0,
    'default' => TRUE,

Proposed resolution

Remove the @todo in Language class as #2108599: Convert language_default to CMI is in.

Remaining tasks

User interface changes

API changes

Originally reported by michaellenahan at #2108599-35: Convert language_default to CMI

#3 2182093-DefaultLanguage-3.patch523 bytesThisIsDog
PASSED: [[SimpleTest]]: [MySQL] 63,157 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


michaellenahan’s picture

To get started, here's an export of where Language::$defaultValues is being used as of now.

core/includes  (2 usages found)  (2 usages found)
        install_begin_request  (2 usages found)
            (306: 40) $default_language_values = Language::$defaultValues;
            (384: 67) $container->setParameter('language.default_values', Language::$defaultValues);
core/lib/Drupal/Core  (1 usage found)
    DrupalKernel.php  (1 usage found)
        DrupalKernel  (1 usage found)
            buildContainer  (1 usage found)
                (526: 42) $default_language_values = Language::$defaultValues;
core/modules/locale/lib/Drupal/locale/Tests  (1 usage found)
    LocaleUninstallTest.php  (1 usage found)
        LocaleUninstallTest  (1 usage found)
            testUninstallProcess  (1 usage found)
                (99: 75) $language_manager = new LanguageManager(new LanguageDefault(Language::$defaultValues));
core/modules/simpletest/lib/Drupal/simpletest  (2 usages found)
    DrupalUnitTestBase.php  (1 usage found)
        DrupalUnitTestBase  (1 usage found)
            containerBuild  (1 usage found)
                (160: 73) $this->container->setParameter('language.default_values', Language::$defaultValues);
    TestBase.php  (1 usage found)
        TestBase  (1 usage found)
            prepareEnvironment  (1 usage found)
                (1006: 73) $this->container->setParameter('language.default_values', Language::$defaultValues);
ThisIsDog’s picture

Assigned: Unassigned » ThisIsDog
ThisIsDog’s picture

Status: Active » Needs review
523 bytes
PASSED: [[SimpleTest]]: [MySQL] 63,157 pass(es). View

I took a look at this and it seems to happen early enough you wouldn't use a Language Manager object. For example, two of the references are in the install file. Others would be creating a Language Manager object with another Language Manager object. I'm not sure what other work would need to be done other than removing the @todo.

I've gone ahead and submitted a patch to remove that line, but if something else needs to be done let me know and I'll update the patch.

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +SprintWeekend2014

Yeah this looks like this was made use in more places and is not to be removed anymore.

alexpott’s picture

Yep language config entities are provided by the language module so we need to hold this configuration somewhere else. This is a good a place as any because without the language module enabled none of this is configurable.

alexpott’s picture

Title: Remove default language variable » Fix documentation of Language::$defaultValues
Component: configuration system » documentation
Category: Task » Bug report
jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all! Committed to 8.x.

Gábor Hojtsy’s picture

Issue tags: -sprint

Yay, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.