Skip to content

Commit

Permalink
Merge pull request #7713 from Automattic/remove/loading-translations-…
Browse files Browse the repository at this point in the history
…code

Don't manually load translation files
  • Loading branch information
donnapep authored Dec 2, 2024
2 parents a8f600c + 531986a commit e6bf3b1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
4 changes: 4 additions & 0 deletions changelog/deprecate-ptranslation-load-functions
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: deprecated

Deprecate `load_localisation` and `load_plugin_textdomain` functions
4 changes: 4 additions & 0 deletions changelog/remove-loading-translations-code
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: removed

Removed manual loading of translations
12 changes: 6 additions & 6 deletions includes/class-sensei.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,7 @@ private function __construct( $main_plugin_file_name, $args ) {
* @since 1.9.0
*/
protected function init() {

// Localisation.
$this->load_plugin_textdomain();
add_action( 'init', array( $this, 'load_localisation' ), 0 );
// Localization.
add_action( 'update_option_WPLANG', array( $this, 'maybe_initiate_rewrite_rules_flush_after_language_change' ), 10, 2 );
add_action( 'upgrader_process_complete', array( $this, 'maybe_initiate_rewrite_rules_flush_on_translation_update' ), 10, 2 );

Expand Down Expand Up @@ -986,9 +983,10 @@ public function register_widgets() {
*
* @access public
* @since 1.0.0
* @return void
* @deprecated $$next-version$$
*/
public function load_localisation() {
_deprecated_function( __METHOD__, '$$next-version$$' );

load_plugin_textdomain( 'sensei-lms', false, dirname( plugin_basename( $this->main_plugin_file_name ) ) . '/lang/' );
}
Expand All @@ -998,9 +996,11 @@ public function load_localisation() {
*
* @access public
* @since 1.0.0
* @return void
* @deprecated $$next-version$$
*/
public function load_plugin_textdomain() {
_deprecated_function( __METHOD__, '$$next-version$$' );

$domain = 'sensei-lms';

if ( is_admin() ) {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e-playwright/pages/admin/courses/courses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class CoursesPage extends PostType {
this.wizardModal = new WizardModal( wizardLocator );

this.createCourseButton = page.locator(
'a.page-title-action[href$="post-new.php?post_type=course"]:has-text("New Course")'
'a.page-title-action[href$="post-new.php?post_type=course"]:has-text("New Course"):visible'
);

this.publishButton = page.locator(
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e-playwright/pages/admin/courses/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default class CoursesPage extends PostType {
this.wizardModal = new WizardModal( wizardLocator );

this.createCourseButton = page.locator(
'a.page-title-action[href$="post-new.php?post_type=course"]:has-text("New Course")'
'a.page-title-action[href$="post-new.php?post_type=course"]:has-text("New Course"):visible'
);

this.courseOutlineBlock = new CourseOutline( page );
Expand Down

0 comments on commit e6bf3b1

Please sign in to comment.