From 8461178f3340489b69b3ce2e7cb39a7359dea37b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Fernanda=20Magallanes?= <35668326+MaferMazu@users.noreply.github.com> Date: Tue, 2 Apr 2024 15:30:44 -0500 Subject: [PATCH] fix: internationalization and slug text domain congruence (#69) * fix: internationalization and slug text domain congruence * fix: add a specific text domain to check in the phpcs tests --- ...-openedx-commerce-enrollment-info-form.php | 28 +++++++++---------- .../class-openedx-commerce-enrollment.php | 16 +++++------ .../class-openedx-commerce-post-type.php | 20 ++++++------- phpcs.xml | 10 +++++++ utils/openedx-utils.php | 12 ++++---- 5 files changed, 48 insertions(+), 38 deletions(-) diff --git a/admin/views/class-openedx-commerce-enrollment-info-form.php b/admin/views/class-openedx-commerce-enrollment-info-form.php index 5afb965..e9c2b02 100644 --- a/admin/views/class-openedx-commerce-enrollment-info-form.php +++ b/admin/views/class-openedx-commerce-enrollment-info-form.php @@ -116,7 +116,7 @@ public function render_enrollment_info_form( $post ) { ?> > ? - + @@ -126,8 +126,8 @@ public function render_enrollment_info_form( $post ) { ? - - + + @@ -141,7 +141,7 @@ public function render_enrollment_info_form( $post ) { ? - + @@ -160,7 +160,7 @@ public function render_enrollment_info_form( $post ) { ?> > ? - + @@ -195,31 +195,31 @@ public function render_enrollment_info_form( $post ) { ?> ? - + - + ? - + - + ? - + - + - + diff --git a/includes/model/class-openedx-commerce-enrollment.php b/includes/model/class-openedx-commerce-enrollment.php index 825258b..7d6fda6 100644 --- a/includes/model/class-openedx-commerce-enrollment.php +++ b/includes/model/class-openedx-commerce-enrollment.php @@ -148,7 +148,7 @@ public function register_status() { register_post_status( 'success', array( - 'label' => __( 'success', 'wp-openedx-commerce' ), + 'label' => __( 'success', 'openedx-commerce' ), 'public' => false, 'internal' => true, 'private' => true, @@ -156,13 +156,13 @@ public function register_status() { 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, // translators: %s: number of items. - 'label_count' => _n_noop( 'Success (%s)', 'Success (%s)', 'wp-openedx-commerce' ), + 'label_count' => _n_noop( 'Success (%s)', 'Success (%s)', 'openedx-commerce' ), ) ); register_post_status( 'no_process', array( - 'label' => __( 'success', 'wp-openedx-commerce' ), + 'label' => __( 'success', 'openedx-commerce' ), 'public' => false, 'internal' => true, 'private' => true, @@ -170,13 +170,13 @@ public function register_status() { 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, // translators: %s: number of items. - 'label_count' => _n_noop( 'No process (%s)', 'No process (%s)', 'wp-openedx-commerce' ), + 'label_count' => _n_noop( 'No process (%s)', 'No process (%s)', 'openedx-commerce' ), ) ); register_post_status( 'pending', array( - 'label' => __( 'pending', 'wp-openedx-commerce' ), + 'label' => __( 'pending', 'openedx-commerce' ), 'public' => false, 'internal' => true, 'private' => true, @@ -184,13 +184,13 @@ public function register_status() { 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, // translators: %s: number of items. - 'label_count' => _n_noop( 'Pending (%s)', 'Pending (%s)', 'wp-openedx-commerce' ), + 'label_count' => _n_noop( 'Pending (%s)', 'Pending (%s)', 'openedx-commerce' ), ) ); register_post_status( 'error', array( - 'label' => __( 'error', 'wp-openedx-commerce' ), + 'label' => __( 'error', 'openedx-commerce' ), 'public' => false, 'internal' => true, 'private' => true, @@ -198,7 +198,7 @@ public function register_status() { 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, // translators: %s: number of items. - 'label_count' => _n_noop( 'Error (%s)', 'Error (%s)', 'wp-openedx-commerce' ), + 'label_count' => _n_noop( 'Error (%s)', 'Error (%s)', 'openedx-commerce' ), ) ); } diff --git a/includes/model/class-openedx-commerce-post-type.php b/includes/model/class-openedx-commerce-post-type.php index 9d37a20..90089b8 100644 --- a/includes/model/class-openedx-commerce-post-type.php +++ b/includes/model/class-openedx-commerce-post-type.php @@ -101,25 +101,25 @@ public function register_post_type() { 'name' => $this->plural, 'singular_name' => $this->single, 'name_admin_bar' => $this->single, - 'add_new' => _x( 'Add New', $this->post_type, 'wp-openedx-commerce' ), // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralContext + 'add_new' => sprintf( _x( 'Add New', 'openedx-commerce', 'openedx-commerce' ), $this->post_type ), // translators: %s: Name of the post type in singular. - 'add_new_item' => sprintf( __( 'Add New %s', 'wp-openedx-commerce' ), $this->single ), + 'add_new_item' => sprintf( __( 'Add New %s', 'openedx-commerce' ), $this->single ), // translators: %s: Name of the post type in singular. - 'edit_item' => sprintf( __( 'Edit %s', 'wp-openedx-commerce' ), $this->single ), + 'edit_item' => sprintf( __( 'Edit %s', 'openedx-commerce' ), $this->single ), // translators: %s: Name of the post type in singular. - 'new_item' => sprintf( __( 'New %s', 'wp-openedx-commerce' ), $this->single ), + 'new_item' => sprintf( __( 'New %s', 'openedx-commerce' ), $this->single ), // translators: %s: Name of the post type in plural. - 'all_items' => sprintf( __( 'All %s', 'wp-openedx-commerce' ), $this->plural ), + 'all_items' => sprintf( __( 'All %s', 'openedx-commerce' ), $this->plural ), // translators: %s: Name of the post type in singular. - 'view_item' => sprintf( __( 'View %s', 'wp-openedx-commerce' ), $this->single ), + 'view_item' => sprintf( __( 'View %s', 'openedx-commerce' ), $this->single ), // translators: %s: Name of the post type in plural. - 'search_items' => sprintf( __( 'Search %s', 'wp-openedx-commerce' ), $this->plural ), + 'search_items' => sprintf( __( 'Search %s', 'openedx-commerce' ), $this->plural ), // translators: %s: Name of the post type in plural. - 'not_found' => sprintf( __( 'No %s Found', 'wp-openedx-commerce' ), $this->plural ), + 'not_found' => sprintf( __( 'No %s Found', 'openedx-commerce' ), $this->plural ), // translators: %s: Name of the post type in plural. - 'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'wp-openedx-commerce' ), $this->plural ), + 'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'openedx-commerce' ), $this->plural ), // translators: %s: Name of the post type in singular. - 'parent_item_colon' => sprintf( __( 'Parent %s' ), $this->single ), + 'parent_item_colon' => sprintf( __( 'Parent %s', 'openedx-commerce' ), $this->single ), 'menu_name' => $this->plural, ); diff --git a/phpcs.xml b/phpcs.xml index eae5329..222dd59 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -8,6 +8,7 @@ ./admin/index.php ./public/index.php index.php + composer-setup.php @@ -18,6 +19,15 @@ + + + + + + + + + diff --git a/utils/openedx-utils.php b/utils/openedx-utils.php index ee6af00..eb641c8 100644 --- a/utils/openedx-utils.php +++ b/utils/openedx-utils.php @@ -13,11 +13,11 @@ */ function get_enrollment_options() { return array( - 'Honor' => __( 'Honor', 'wp-openedx-commerce' ), - 'Audit' => __( 'Audit', 'wp-openedx-commerce' ), - 'Verified' => __( 'Verified', 'wp-openedx-commerce' ), - 'Credit' => __( 'Credit', 'wp-openedx-commerce' ), - 'Professional' => __( 'Professional', 'wp-openedx-commerce' ), - 'No ID Professional' => __( 'No ID Professional', 'wp-openedx-commerce' ), + 'Honor' => __( 'Honor', 'openedx-commerce' ), + 'Audit' => __( 'Audit', 'openedx-commerce' ), + 'Verified' => __( 'Verified', 'openedx-commerce' ), + 'Credit' => __( 'Credit', 'openedx-commerce' ), + 'Professional' => __( 'Professional', 'openedx-commerce' ), + 'No ID Professional' => __( 'No ID Professional', 'openedx-commerce' ), ); }