function drush_language_disable in Drush Language Commands 7
Disables a language.
File
- ./
language.drush.inc, line 151 - 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_disable() {
$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) {
$languages = language_list();
if (array_key_exists($langcode, $languages)) {
if ($languages[$langcode]->enabled) {
// disable the default english
db_update('languages')
->condition('language', $langcode)
->fields(array(
'enabled' => 0,
))
->execute();
// Changing the language settings impacts the interface.
cache_clear_all('*', 'cache_page', TRUE);
drush_log(dt("Disabled language : !language ", array(
'!language' => $langcode,
)), 'ok');
}
else {
drush_print(dt("Language already disabled: !language ", array(
'!language' => $langcode,
)), 'warning');
}
}
}
}