diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index db230ff..0436ce1 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -239,6 +239,9 @@ function locale_theme() { 'render element' => 'form', 'file' => 'locale.pages.inc', ), + 'locale_project_language_update_info' => array( + 'arguments' => array('projects' => array(), 'type' => ''), + ), ); } diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc index f0c05e6..1f6df82 100644 --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -591,34 +591,95 @@ function locale_translate_settings_submit($form, &$form_state) { * @see locale_menu() */ function locale_translation_status_form($form, &$form_state) { - module_load_include('compare.inc', 'locale'); - //locale_translation_flush_projects(); - $languages = locale_translatable_language_list(); + if (!$languages) { + drupal_set_message(t('No translatable languages available. Add language first.', array('@add_language' => url('admin/config/regional/language'))), 'warning'); + return $form; + } + + module_load_include('compare.inc', 'locale'); + locale_translation_flush_projects(); + $projects = locale_translation_get_projects(); $status = state()->get('locale.translation_status'); - if (!$languages) { - drupal_set_message(t('No translatable languages available. Add language first.', array('@add_lanuage' => url('admin/config/regional/language'))), 'warning'); + // Prepare information about projects which have available translation + // updates. + $projects_to_update = array(); + foreach ($status as $project_id => $project) { + foreach ($project as $langcode => $project_info) { + if (!isset($project_info->type)) { + $projects_to_update[$langcode]['not_found'][] = array( + 'name' => $project_info->name, + 'version' => $project_info->version, + ); + } + elseif ($project_info->type != 'current') { + $projects_to_update[$langcode]['updates'][] = array( + 'name' => $project_info->name, + 'version' => $project_info->version, + ); + } + } } - // @todo Add user interface update for translation update. - // Followup issues: Display translation status http://drupal.org/node/1804702 - // and Translations update feature user experience http://drupal.org/node/1029554 - $form['langcodes'] = array( - '#type' => 'value', - '#value' => drupal_map_assoc(array_keys($languages)), + // @todo It could be useful to consider refactoring theme_update_last_check(). + $last = state()->get('locale.translation_last_checked'); + $markup = '
' . t('This applies language updates to %projects.', array( + '%projects' => implode(', ', $project_list['flat']), + )) . "
", + ); + $output['updates_details'] = array( + '#theme' => 'item_list', + '#items' => $project_list['details'], + '#attributes' => array( + 'class' => array('details'), + ), + ); + } + $project_list = array('count' => 0); + if (isset($variables['projects']['not_found'])) { + foreach ($variables['projects']['not_found'] as $project) { + $project_list['count']++; + $project_list['details'][] = format_string('!name (!version)', array( + '!name' => $project['name'], + '!version' => $project['version'], + )); + } + $output['not_found_summary'] = array( + '#type' => 'markup', + '#markup' => '' . t('No updates were found for %count projects.', array( + '%count' => $project_list['count'], + )) . '
', + ); + $output['not_found_details'] = array( + '#theme' => 'item_list', + '#items' => $project_list['details'], + '#attributes' => array( + 'class' => array('details'), + ), + ); + } + return $output; +}