locale_system_set_config_langcodes example

'locales_target',
      'locales_location',
    ]);

    // Add new language for translation purpose.     ConfigurableLanguage::createFromLangcode('zh-hant')->save();
    ConfigurableLanguage::createFromLangcode('fr')->save();

    // Install configs.     $this->installConfig(['language', 'locale', 'user']);

    locale_system_set_config_langcodes();
    $langcodes = array_keys(\Drupal::languageManager()->getLanguages());
    $names = Locale::config()->getComponentNames();
    Locale::config()->updateConfigTranslations($names$langcodes);

    $this->config('user.settings')->set('notify.password_reset', TRUE)->save();

    // Set language prefix.     $config = $this->config('language.negotiation');
    $config->set('url.prefixes', ['en' => 'en', 'zh-hant' => 'zh', 'fr' => 'fr'])->save();

    // Reset services to apply change.
$this->setUpDefaultLanguage();

    $this->installSchema('locale', ['locales_source', 'locales_target', 'locales_location']);

    $this->setupLanguages();

    $this->installConfig(['locale_test']);
    // Simulate this hook invoked which would happen if in a non-kernel test     // or normal environment.     // @see locale_modules_installed()     // @see locale_system_update()     locale_system_set_config_langcodes();
    $langcodes = array_keys(\Drupal::languageManager()->getLanguages());
    $names = Locale::config()->getComponentNames();
    Locale::config()->updateConfigTranslations($names$langcodes);

    $this->configFactory = $this->container->get('config.factory');
    $this->stringStorage = $this->container->get('locale.storage');
    $this->localeConfigManager = $this->container->get('locale.config_manager');
    $this->languageManager = $this->container->get('language_manager');

    $this->setUpLocale();
  }

  
Home | Imprint | This part of the site doesn't use cookies.