From 03680e9e9d09e8b990ae9a5cb1b4933d87416265 Mon Sep 17 00:00:00 2001 From: Felipe Montoya Date: Mon, 4 Aug 2025 17:01:07 -0500 Subject: [PATCH 1/3] chore: ignoring the build directory --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index a191bc1..b0947f3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ phpcs-report.xml build .DS_Store source/.DS_Store + +### Build files ### +openedx-commerce From 6442832610d95ff483d597dc2ecc93c5f1b84435 Mon Sep 17 00:00:00 2001 From: Felipe Montoya Date: Mon, 4 Aug 2025 16:49:55 -0500 Subject: [PATCH 2/3] fix: QA reported an automatic translations error --- includes/class-openedx-commerce-i18n.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/includes/class-openedx-commerce-i18n.php b/includes/class-openedx-commerce-i18n.php index 56e1b18..891558c 100644 --- a/includes/class-openedx-commerce-i18n.php +++ b/includes/class-openedx-commerce-i18n.php @@ -10,9 +10,7 @@ * @package Openedx_Commerce * @subpackage Openedx_Commerce/includes */ - namespace OpenedX_Commerce; - /** * Define the internationalization functionality. * @@ -24,19 +22,20 @@ * @subpackage Openedx_Commerce/includes */ class Openedx_Commerce_I18n { - - /** * Load the plugin text domain for translation. * * @since 1.0.0 */ public function load_plugin_textdomain() { - - load_plugin_textdomain( - 'openedx-commerce', - false, - dirname( plugin_basename( __FILE__ ), 2 ) . '/languages/' - ); + // WordPress 4.6+ automatically loads translations for plugins hosted on WordPress.org. + // Manual loading is only needed for older WordPress versions or custom translation paths. + if ( version_compare( get_bloginfo( 'version' ), '4.6', '<' ) ) { + load_plugin_textdomain( + 'openedx-commerce', + false, + dirname( plugin_basename( __FILE__ ), 2 ) . '/languages/' + ); + } } } From 103393fe9f0a30ccce4f5b62672cf95b67cedcc8 Mon Sep 17 00:00:00 2001 From: Felipe Montoya Date: Mon, 4 Aug 2025 17:29:01 -0500 Subject: [PATCH 3/3] chore: updating i18n management to 2025 standards --- includes/class-openedx-commerce-i18n.php | 41 ------------------------ includes/class-openedx-commerce.php | 29 ----------------- 2 files changed, 70 deletions(-) delete mode 100644 includes/class-openedx-commerce-i18n.php diff --git a/includes/class-openedx-commerce-i18n.php b/includes/class-openedx-commerce-i18n.php deleted file mode 100644 index 891558c..0000000 --- a/includes/class-openedx-commerce-i18n.php +++ /dev/null @@ -1,41 +0,0 @@ -plugin_name = 'openedx-commerce'; $this->load_dependencies(); - $this->set_locale(); $this->define_admin_hooks(); $this->define_public_hooks(); $this->define_plugin_settings_hooks(); @@ -84,7 +83,6 @@ public function __construct() { * Include the following files that make up the plugin: * * - Openedx_Commerce_Loader. Orchestrates the hooks of the plugin. - * - Openedx_Commerce_I18n. Defines internationalization functionality. * - Openedx_Commerce_Admin. Defines all hooks for the admin area. * - Openedx_Commerce_Public. Defines all hooks for the public side of the site. * @@ -103,13 +101,6 @@ private function load_dependencies() { include_once plugin_dir_path( __DIR__ ) . 'includes/class-openedx-commerce-loader.php'; - /** - * The class responsible for defining internationalization functionality - * of the plugin. - */ - include_once plugin_dir_path( __DIR__ ) - . 'includes/class-openedx-commerce-i18n.php'; - /** * The class responsible for defining all actions that occur in the admin area. */ @@ -170,26 +161,6 @@ private function load_dependencies() { . 'includes/model/class-openedx-commerce-api-calls.php'; } - /** - * Define the locale for this plugin for internationalization. - * - * Uses the Openedx_Commerce_I18n class in order to set the domain and to register the hook - * with WordPress. - * - * @since 1.0.0 - * @access private - */ - private function set_locale() { - - $plugin_i18n = new Openedx_Commerce_I18n(); - - $this->loader->add_action( - 'plugins_loaded', - $plugin_i18n, - 'load_plugin_textdomain' - ); - } - /** * Register all of the hooks related to the admin area functionality * of the plugin.