function drush_l10n_update_status in Localization update 7.2
Same name and namespace in other branches
- 6 l10n_update.drush.inc \drush_l10n_update_status()
- 7 l10n_update.drush.inc \drush_l10n_update_status()
Callback for command l10n-update-status.
File
- ./
l10n_update.drush.inc, line 62 - Drush interface to l10n-update functionalities.
Code
function drush_l10n_update_status() {
$status = l10n_update_get_status();
if (!empty($status)) {
$languages = drush_get_option('languages');
// Build table header.
$table = array();
$header = array(
dt('Project'),
);
foreach ($languages as $language) {
$header[] = $language->name;
}
$table[] = $header;
// Iterate projects to obtain per language status.
foreach ($status as $project) {
$row = array();
// First column: Project name & version number.
$project_details = reset($project);
$title = isset($project_details->title) ? $project_details->title : $project_details->name;
$row[] = dt('@project (@version)', array(
'@project' => $title,
'@version' => $project_details->version,
));
// Other columns: Status per language.
foreach ($languages as $langcode => $language) {
$current = $project[$langcode]->type == L10N_UPDATE_CURRENT;
$local_update = $project[$langcode]->type == L10N_UPDATE_LOCAL;
$remote_update = $project[$langcode]->type == L10N_UPDATE_REMOTE;
if ($local_update || $remote_update) {
$row[] = $remote_update ? dt('Remote update available') : dt('Local update available');
}
elseif ($current) {
$row[] = dt('Up to date');
}
else {
$row[] = dt('No info');
}
}
$table[] = $row;
}
drush_print_table($table, TRUE);
}
else {
drush_log(dt('No languages to update.'), 'warning');
}
}