function drush_language_default in Drush Language Commands 7
Assigns the default language.
File
- ./
language.drush.inc, line 184 - Drush commands allowing languages to be added, switched, enabled, disabled, imported, exported and update prefix from the commandline. This module only provides drush commands, so you will see no functionality in the UI.
Code
function drush_language_default() {
$args = func_get_args();
if (count($args) == 0) {
drush_set_error(dt('Please provide one or more language codes as arguments.'));
return;
}
foreach ($args as $langcode) {
// get all the languages
$languages = language_list();
if (array_key_exists($langcode, $languages)) {
variable_set('language_default', (object) $languages[$langcode]);
drush_log(dt("!language assigned as default", array(
'!language' => $langcode,
)), 'ok');
}
else {
drush_log(dt("Specified language does not exist !language", array(
'!language' => $langcode,
)), 'warning');
}
}
}