Check for if new locale has language pack installed.

This commit is contained in:
budzanowski 2020-07-23 22:52:59 +02:00
parent 70c65f60f2
commit 623363ba50
1 changed files with 2 additions and 2 deletions

View File

@ -175,7 +175,7 @@ class WC_Helper_Updater {
* @return array Update data {product_id => data}
*/
public static function get_translations_update_data() {
$payload = array();
$payload = array();
$installed_translations = wp_get_installed_translations( 'plugins' );
@ -254,7 +254,7 @@ class WC_Helper_Updater {
foreach ( $response['data'] as $plugin_name => $language_packs ) {
foreach ( $language_packs as $language_pack ) {
// Maybe we have this language pack already installed so lets check revision date.
if ( array_key_exists( $plugin_name, $installed_translations ) ) {
if ( array_key_exists( $plugin_name, $installed_translations ) && array_key_exists( $language_pack['wp_locale'], $installed_translations[ $plugin_name ] ) ) {
$installed_translation_revision_time = new DateTime( $installed_translations[ $plugin_name ][ $language_pack['wp_locale'] ]['PO-Revision-Date'] );
$new_translation_revision_time = new DateTime( $language_pack['last_modified'] );
// Skip if translation language pack is not newer than what is installed already.