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

Fix translations loading before the init hook #2866

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

iodic
Copy link
Collaborator

@iodic iodic commented Jan 31, 2025

Changes proposed in this Pull Request:

The plugin's admin page properties contained strings being translated and these were called before the init hook causing the following notice to be logged:

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the facebook-for-woocommerce domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/public_html/wp-includes/functions.php on line 6114

This changeset moves the admin pages' properties into the init hook so we follow the proper way of handling translations.

More information about the issue: https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/#Enhanced-support-for-only-using-PHP-translation-files.

Screenshots:

Screenshot 2025-02-05 at 12 15 08

Detailed test instructions:

To recreate the issue, please follow these steps:

  1. Enable WP_DEBUG and either show the errors on page or in the debug log.
  2. Switch the site to a different language, e.g. French.
  3. You should see the notice at the top of the admin page (like in the screenshot above) or in the debug log.

@github-actions github-actions bot added changelog: fix Took care of something that wasn't working. type: bug The issue is a confirmed bug. labels Jan 31, 2025
@vinkmeta
Copy link
Contributor

Hey, Changes looks good! Can you please update the PR Summary highlighting the changes in behaviour before and after this PR.

@devbodaghe
Copy link
Contributor

This looks like it moves some stuff around
Can you kindly update with what it aims to do

@iodic iodic changed the title Fix _load_textdomain_just_in_time notice Fix translations loading before the init hook Feb 5, 2025
@iodic
Copy link
Collaborator Author

iodic commented Feb 5, 2025

I have updated the PR description and the code style in the changeset was updated.

@iodic iodic requested a review from vahidkay-meta February 5, 2025 11:33
@iodic iodic linked an issue Feb 5, 2025 that may be closed by this pull request
@iodic iodic marked this pull request as ready for review February 5, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Took care of something that wasn't working. CLA Signed type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text domain loading issue
6 participants