diff --git a/aspire-update.php b/aspire-update.php index caa44a9..05c24f5 100644 --- a/aspire-update.php +++ b/aspire-update.php @@ -30,8 +30,19 @@ define( 'AP_VERSION', '0.5' ); } + +add_action( 'plugins_loaded', 'define_constant' ); +function define_constant() { + if ( ! defined( 'AP_PATH' ) ) { + define( 'AP_PATH', dirname( plugin_basename( __FILE__ ) ) ); + } +} + require_once __DIR__ . '/includes/autoload.php'; -if ( ! defined( 'AP_RUN_TESTS' ) ) { - new AspireUpdate\Controller(); +add_action( 'plugins_loaded', 'aspire_update' ); +function aspire_update() { + if ( ! defined( 'AP_RUN_TESTS' ) ) { + new AspireUpdate\Controller(); + } } diff --git a/includes/class-controller.php b/includes/class-controller.php index 5897457..faf5d42 100644 --- a/includes/class-controller.php +++ b/includes/class-controller.php @@ -20,6 +20,8 @@ public function __construct() { Themes_Screens::get_instance(); $this->api_rewrite(); + + add_action( 'init', array( $this, 'load_textdomain' ) ); } /** @@ -46,4 +48,13 @@ private function api_rewrite() { } } } + + /** + * Load translations. + * @return void + */ + public function load_textdomain() { + \load_plugin_textdomain( 'AspireUpdate', false, AP_PATH . '/languages/' ); + } + }