Changeset 65226 for trunk/src/wp-admin/update-core.php
- Timestamp:
- 11/03/2026 01:38:37 PM (9 days ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/update-core.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/update-core.php
r61520 r65226 814 814 */ 815 815 function list_translation_updates() { 816 $ updates = wp_get_translation_updates();817 if ( ! $ updates ) {816 $translation_updates = wp_get_translation_update_data(); 817 if ( ! $translation_updates ) { 818 818 if ( 'en_US' !== get_locale() ) { 819 819 echo '<h2>' . __( 'Translations' ) . '</h2>'; … … 823 823 } 824 824 825 $form_action = 'update-core.php?action=do-translation-upgrade'; 825 $form_action = 'update-core.php?action=do-translation-upgrade'; 826 $updates_count = count( $translation_updates ); 826 827 ?> 827 <h2><?php _e( 'Translations' ); ?></h2> 828 <h2> 829 <?php 830 printf( 831 '%s <span class="count">(%s)</span>', 832 __( 'Translations' ), 833 number_format_i18n( $updates_count ) 834 ); 835 ?> 836 </h2> 828 837 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade"> 829 <p><?php _e( 'New translations are available.' ); ?></p> 838 <p><?php _e( 'The following translation updates are available. Leave any translation updates unchecked if you want to install them later, then click “Update Translations”.' ); ?></p> 839 <p><?php _e( 'Translation updates you leave unchecked will remain available until you select them.' ); ?></p> 830 840 <?php wp_nonce_field( 'upgrade-translations' ); ?> 831 <p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p> 841 <p><input id="upgrade-translations" class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p> 842 <table class="widefat updates-table" id="update-translations-table"> 843 <thead> 844 <tr> 845 <td class="manage-column check-column"><input type="checkbox" id="translations-select-all" /></td> 846 <td class="manage-column"><label for="translations-select-all"><?php _e( 'Select All' ); ?></label></td> 847 </tr> 848 </thead> 849 850 <tbody class="plugins"> 851 <?php foreach ( $translation_updates as $translation_update ) : ?> 852 <?php $checkbox_id = 'checkbox_' . md5( $translation_update['id'] ); ?> 853 <tr> 854 <td class="check-column"> 855 <input type="hidden" name="translations[]" value="<?php echo esc_attr( $translation_update['id'] ); ?>" /> 856 <input type="checkbox" name="checked[]" id="<?php echo esc_attr( $checkbox_id ); ?>" value="<?php echo esc_attr( $translation_update['id'] ); ?>" <?php checked( $translation_update['checked'] ); ?> /> 857 <label for="<?php echo esc_attr( $checkbox_id ); ?>"> 858 <span class="screen-reader-text"> 859 <?php 860 printf( 861 /* translators: 1: Project name, 2: Language name or locale. */ 862 esc_html__( 'Select the translation update for %1$s in %2$s' ), 863 esc_html( $translation_update['name'] ), 864 esc_html( $translation_update['language'] ) 865 ); 866 ?> 867 </span> 868 </label> 869 </td> 870 <td class="plugin-title"><p> 871 <strong><?php echo esc_html( $translation_update['name'] ); ?></strong> 872 <?php 873 printf( 874 /* translators: 1: Language name or locale, 2: Version number. */ 875 esc_html__( '%1$s translation is available for version %2$s.' ), 876 esc_html( $translation_update['language'] ), 877 esc_html( $translation_update['version'] ) 878 ); 879 880 if ( $translation_update['deferred'] ) { 881 echo ' '; 882 esc_html_e( 'This translation update will remain available until you select it.' ); 883 } 884 ?> 885 </p></td> 886 </tr> 887 <?php endforeach; ?> 888 </tbody> 889 890 <tfoot> 891 <tr> 892 <td class="manage-column check-column"><input type="checkbox" id="translations-select-all-2" /></td> 893 <td class="manage-column"><label for="translations-select-all-2"><?php _e( 'Select All' ); ?></label></td> 894 </tr> 895 </tfoot> 896 </table> 897 <p><input id="upgrade-translations-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p> 832 898 </form> 833 899 <?php … … 1003 1069 1004 1070 if ( 'en_US' !== get_locale() ) { 1005 $updates_howto .= '<p>' . __( '<strong>Translations</strong> — T he files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the “Update Translations”</strong> button.' ) . '</p>';1071 $updates_howto .= '<p>' . __( '<strong>Translations</strong> — Translation updates are selected for installation by default. Leave any translation updates unchecked if you want to install them later, then <strong>click the “Update Translations”</strong> button. Translation updates you leave unchecked will remain available until you select them.' ) . '</p>'; 1006 1072 } 1007 1073 … … 1093 1159 } 1094 1160 1161 $translation_updates_status = isset( $_GET['translation_updates'] ) ? wp_unslash( $_GET['translation_updates'] ) : ''; 1162 if ( is_string( $translation_updates_status ) ) { 1163 $translation_updates_status = sanitize_key( $translation_updates_status ); 1164 } else { 1165 $translation_updates_status = ''; 1166 } 1167 1168 if ( 'deferred' === $translation_updates_status ) { 1169 wp_admin_notice( 1170 __( 'The unchecked translation updates will remain available until you select them.' ), 1171 array( 1172 'type' => 'success', 1173 ) 1174 ); 1175 } 1176 1095 1177 $last_update_check = false; 1096 1178 $current = get_site_transient( 'update_core' ); … … 1276 1358 check_admin_referer( 'upgrade-translations' ); 1277 1359 1360 // Requests without the form's update identifiers must not install all translations. 1361 $translation_update_ids = array_unique( 1362 array_map( 1363 'sanitize_text_field', 1364 wp_unslash( (array) ( $_POST['translations'] ?? array() ) ) 1365 ) 1366 ); 1367 $selected_translation_update_ids = array_unique( 1368 array_map( 1369 'sanitize_text_field', 1370 wp_unslash( (array) ( $_POST['checked'] ?? array() ) ) 1371 ) 1372 ); 1373 1374 $selected_translation_updates = wp_process_translation_update_selection( $translation_update_ids, $selected_translation_update_ids ); 1375 1376 if ( false === $selected_translation_updates ) { 1377 wp_redirect( self_admin_url( 'update-core.php' ) ); 1378 exit; 1379 } 1380 1381 if ( empty( $selected_translation_updates ) ) { 1382 wp_redirect( add_query_arg( 'translation_updates', 'deferred', self_admin_url( 'update-core.php' ) ) ); 1383 exit; 1384 } 1385 1278 1386 require_once ABSPATH . 'wp-admin/admin-header.php'; 1279 1387 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; … … 1285 1393 1286 1394 $upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) ); 1287 $result = $upgrader->bulk_upgrade( );1395 $result = $upgrader->bulk_upgrade( array_values( $selected_translation_updates ) ); 1288 1396 1289 1397 wp_localize_script(
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)