wpseek.com
A WordPress-centric search engine for devs and theme authors
list_translation_updates › WordPress Function
Since3.7.0
Deprecatedn/a
› list_translation_updates ( No parameters )
| Defined at: |
|
| Codex: |
Display the update translations form.
Source
function list_translation_updates() {
$translation_updates = wp_get_translation_update_data();
if ( ! $translation_updates ) {
if ( 'en_US' !== get_locale() ) {
echo '<h2>' . __( 'Translations' ) . '</h2>';
echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>';
}
return;
}
$form_action = 'update-core.php?action=do-translation-upgrade';
$updates_count = count( $translation_updates );
?>
<h2>
<?php
printf(
'%s <span class="count">(%s)</span>',
__( 'Translations' ),
number_format_i18n( $updates_count )
);
?>
</h2>
<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade">
<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>
<p><?php _e( 'Translation updates you leave unchecked will remain available until you select them.' ); ?></p>
<?php wp_nonce_field( 'upgrade-translations' ); ?>
<p><input id="upgrade-translations" class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p>
<table class="widefat updates-table" id="update-translations-table">
<thead>
<tr>
<td class="manage-column check-column"><input type="checkbox" id="translations-select-all" /></td>
<td class="manage-column"><label for="translations-select-all"><?php _e( 'Select All' ); ?></label></td>
</tr>
</thead>
<tbody class="plugins">
<?php foreach ( $translation_updates as $translation_update ) : ?>
<?php $checkbox_id = 'checkbox_' . md5( $translation_update['id'] ); ?>
<tr>
<td class="check-column">
<input type="hidden" name="translations[]" value="<?php echo esc_attr( $translation_update['id'] ); ?>" />
<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'] ); ?> />
<label for="<?php echo esc_attr( $checkbox_id ); ?>">
<span class="screen-reader-text">
<?php
printf(
/* translators: 1: Project name, 2: Language name or locale. */
esc_html__( 'Select the translation update for %1$s in %2$s' ),
esc_html( $translation_update['name'] ),
esc_html( $translation_update['language'] )
);
?>
</span>
</label>
</td>
<td class="plugin-title"><p>
<strong><?php echo esc_html( $translation_update['name'] ); ?></strong>
<?php
printf(
/* translators: 1: Language name or locale, 2: Version number. */
esc_html__( '%1$s translation is available for version %2$s.' ),
esc_html( $translation_update['language'] ),
esc_html( $translation_update['version'] )
);
if ( $translation_update['deferred'] ) {
echo ' ';
esc_html_e( 'This translation update will remain available until you select it.' );
}
?>
</p></td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<td class="manage-column check-column"><input type="checkbox" id="translations-select-all-2" /></td>
<td class="manage-column"><label for="translations-select-all-2"><?php _e( 'Select All' ); ?></label></td>
</tr>
</tfoot>
</table>
<p><input id="upgrade-translations-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p>
</form>
<?php
}