Skip to content

Commit

Permalink
Translations loading fix112 (#114)
Browse files Browse the repository at this point in the history
* Add French translations. 

* load any available translations with code in the plugin
  • Loading branch information
sebastienserre authored Nov 4, 2024
1 parent 1b30e71 commit c93691f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
15 changes: 13 additions & 2 deletions aspire-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
11 changes: 11 additions & 0 deletions includes/class-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public function __construct() {
Themes_Screens::get_instance();

$this->api_rewrite();

add_action( 'init', array( $this, 'load_textdomain' ) );
}

/**
Expand All @@ -46,4 +48,13 @@ private function api_rewrite() {
}
}
}

/**
* Load translations.
* @return void
*/
public function load_textdomain() {
\load_plugin_textdomain( 'AspireUpdate', false, AP_PATH . '/languages/' );
}

}

0 comments on commit c93691f

Please sign in to comment.