From c827695cc9cfa41d00336964ec4339552cb9e64d Mon Sep 17 00:00:00 2001 From: Jonathan Moore Date: Thu, 1 Aug 2019 12:47:09 +0100 Subject: [PATCH] addresses #449 by adding info to woo status report Adds current language, polylang default language, polylang languages and whether WooCommerce translation files are downloaded --- src/Hyyan/WPI/Admin/StatusReport.php | 56 ++++++++++++++++++++++++++++ src/Hyyan/WPI/Plugin.php | 8 ++++ 2 files changed, 64 insertions(+) create mode 100644 src/Hyyan/WPI/Admin/StatusReport.php diff --git a/src/Hyyan/WPI/Admin/StatusReport.php b/src/Hyyan/WPI/Admin/StatusReport.php new file mode 100644 index 0000000..246e41a --- /dev/null +++ b/src/Hyyan/WPI/Admin/StatusReport.php @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +

:
:
: 'locale' ) ); + + foreach ( $langs as $langId => $langLocale ) { + echo($langLocale); + $downloaded = TranslationsDownloader::isDownloaded( $langLocale ); + $location = sprintf( + trailingslashit( WP_LANG_DIR ) + . 'plugins/woocommerce-%s.mo', $langLocale + ); + if ( $downloaded ) { + echo(' (WooCommerce translation file found OK at ' . $location . ') '); + } else { + echo(' Warning - missing WooCommerce translation file NOT found at ' . $location . ' '); + } + echo '
'; + } + ?>
+ + \ No newline at end of file diff --git a/src/Hyyan/WPI/Plugin.php b/src/Hyyan/WPI/Plugin.php index 65c00a4..8486e14 100644 --- a/src/Hyyan/WPI/Plugin.php +++ b/src/Hyyan/WPI/Plugin.php @@ -37,6 +37,7 @@ public function __construct() add_action('init', array($this, 'activate')); add_action('plugins_loaded', array($this, 'loadTextDomain')); + add_action( 'admin_init', array( __CLASS__, 'admin_activate' ) ); add_action( 'pll_add_language', array( __CLASS__, 'handleNewLanguage' ) ); @@ -53,6 +54,13 @@ public function __construct() } } + /* + * enable admin features in admin mode + */ + public static function admin_activate() { + include_once( plugin_dir_path( __FILE__ ) . 'Admin/StatusReport.php'); + } + /* * when new language is added in polylang, flag that default pages should be rechecked * (try not to download immediately as translation files will not be downloaded yet)