Improved the translation update messages

When is multisite shows only the button for download directly
If not is multisite will show the button for make the download with the
WordPress update system and the button to download directly
And added a new button to hide the update message

@mikejolley
This commit is contained in:
claudiosmweb 2014-09-12 19:32:21 -03:00
parent dc0122a4d6
commit b47e649e6a
2 changed files with 25 additions and 1 deletions

View File

@ -132,6 +132,14 @@ class WC_Admin_Status {
echo '<div class="updated"><p>' . __( 'Tax rates successfully deleted', 'woocommerce' ) . '</p></div>';
break;
case 'hide_translation_upgrade' :
update_option( 'woocommerce_language_pack_version', array( WC_VERSION , get_locale() ) );
$notices = get_option( 'woocommerce_admin_notices', array() );
$notices = array_diff( $notices, array( 'translation_upgrade' ) );
update_option( 'woocommerce_admin_notices', $notices );
echo '<div class="updated"><p>' . __( 'Translation update message hidden successfully!', 'woocommerce' ) . '</p></div>';
break;
default :
$action = esc_attr( $_GET['action'] );
if ( isset( $tools[ $action ]['callback'] ) ) {
@ -164,6 +172,9 @@ class WC_Admin_Status {
break;
default :
// Force WordPress find for new updates and hide the WooCommerce translation update
set_site_transient( 'update_plugins', null );
echo '<div class="updated"><p>' . __( 'Translations installed/updated successfully!', 'woocommerce' ) . '</p></div>';
break;
}

View File

@ -7,9 +7,22 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( isset( $_GET['action'] ) && 'hide_translation_upgrade' == $_GET['action'] ) {
return;
}
?>
<div id="message" class="updated woocommerce-message wc-connect">
<p><?php printf( __( '<strong>WooCommerce Translation Available</strong> &#8211; Install or update your <code>%s</code> translation to version <code>%s</code>.', 'woocommerce' ), get_locale(), WC_VERSION ); ?></p>
<p><a href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'do-translation-upgrade' ), admin_url( 'update-core.php' ) ), 'upgrade-translations' ); ?>" class="button-primary"><?php printf( __( 'Update translation', 'woocommerce' ), get_locale() ); ?></a></p>
<p>
<?php if ( is_multisite() ) : ?>
<a href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=translation_upgrade' ), 'debug_action' ); ?>" class="button-primary"><?php _e( 'Update Translation', 'woocommerce' ); ?></a>
<?php else : ?>
<a href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'do-translation-upgrade' ), admin_url( 'update-core.php' ) ), 'upgrade-translations' ); ?>" class="button-primary"><?php _e( 'Update translation', 'woocommerce' ); ?></a>
<a href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=translation_upgrade' ), 'debug_action' ); ?>" class="button-primary"><?php _e( 'Force Update Translation', 'woocommerce' ); ?></a>
<?php endif; ?>
<a href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=hide_translation_upgrade' ), 'debug_action' ); ?>" class="button"><?php _e( 'Hide This Message', 'woocommerce' ); ?></a>
</p>
</div>