public function DrushLanguageCliService::languageDefault in Drush Language Commands 8
Assign an enabled language as default.
Parameters
\Symfony\Component\Console\Style\StyleInterface|\Drupal\drush_language\Drush8Io $io: The $io interface of the cli tool calling.
callable $t: The translation function akin to t().
string $langcode: The langcode of the language which will be set as the default language.
File
- src/
Service/ DrushLanguageCliService.php, line 164
Class
- DrushLanguageCliService
- Class DrushLanguageCliService.
Namespace
Drupal\drush_language\ServiceCode
public function languageDefault($io, callable $t, $langcode) {
$messageArgs = [
'@langcode' => $langcode,
];
$languages = $this->languageManager
->getLanguages();
if (!isset($languages[$langcode])) {
$io
->warning($t('Specified language does not exist: @langcode', $messageArgs));
return;
}
$this->configFactory
->getEditable('system.site')
->set('default_langcode', $langcode)
->save();
$this->languageManager
->reset();
}