Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't manually load translation files #7713

Merged
merged 4 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading