The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Notice PHP - Functi...
 
Share:
Notifications
Clear all

Bug Notice PHP - Function _load_textdomain_just_in_time was called incorrectly

9 Posts
5 Users
0 Reactions
709 Views
Posts: 1
Topic starter
(@patricedefago)
New Member
Joined: 5 months ago

Hi,

I have this notice on my client’s website.

WorPress : 6.7.1

wpDiscuz : 7.6.27

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wpdiscuz 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.

Thanks.

Website URL
Topic Tags
8 Replies
Asti
Posts: 8000
 Asti
Support
(@asti)
Illustrious Member
Joined: 8 years ago

Hi,

We'll check and get back to you soon.

Reply
Posts: 5
(@tiedjetrading)
Active Member
Joined: 10 months ago

Same here, what do you do for this Problem??

PHP Notice: Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>wpdiscuz-frontend-moderation</code> 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 <code>init</code> action or later.

Reply
Posts: 2
(@fetchdesigns)
New Member
Joined: 2 months ago

This is still an issue in the latest version WP Discuz v7.6.29.  When I tested, it appears to be caused by the use of `esc_html__` in the `WpdiscuzAddons` class which is too early to be able to correctly handle translations.  Is this going to be fixed anytime soon?

More details can be found here where WordPress advised of this change that was added in WP 6.7... https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/

Reply
2 Replies
Asti
 Asti
Support
(@asti)
Joined: 8 years ago

Illustrious Member
Posts: 8000

@fetchdesigns 

Could you please send the admin login details to info[at]gvectots.com email address? I'll ask the developers to check the issue for you.

Reply
(@fetchdesigns)
Joined: 2 months ago

New Member
Posts: 2

@asti This is not an error that requires an admin login. It's easily reproducible on a vanilla WordPress install running the latest version of WordPress and the WP Discuz plugin.  Make sure you enable WP_DEBUG and then review the logs and access any page.  I reviewed your plugin and there are numerous files that try to process translations too early which are causing this notice.

For example, in wp-content/plugins/wpdiscuz/options/class.WpdiscuzAddons.php, in your __construct() you run...

$this->initAddons();

This method then uses esc_html__() such as...

"desc" => esc_html__("All 16 addons in one bundle. Save 90% and get Unlimited Site License with one year premium support.", "wpdiscuz"),

However, you cannot run translation methods this early which in the case of that construct it's before `after_setup_theme` or `init`.  Per the WordPress doc I linked earlier...

When attempting to load translations before after_setup_theme or init, WordPress tries to load the current user earlier than usual, without giving other plugins a chance to potentially hook into the process. It also prevents any plugins from filtering translation calls, e.g. for switching the locale or file location. Hence the addition of this warning to call out this unexpected behavior.

This early use of translations is what is causing the notice and should be fixed.  Your logic needs to be refactored to set/translate the text later.

Let me know if you need any further information to try and reproduce on your end.

Reply
Posts: 2
(@epikfrost)
New Member
Joined: 2 months ago

Exact same issue here, i replaced the esc_html__ in WpdiscuzAddons but still am getting the errors, i am using query monitor and it is giving me:

 

_load_textdomain_just_in_time()
wp-includes/l10n.php:1371
get_translations_for_domain()
wp-includes/l10n.php:1409
translate()
wp-includes/l10n.php:195
esc_html__()
wp-includes/l10n.php:340
WpdiscuzOptions->initPhrases()
wp-content/plugins/wpdiscuz/options/class.WpdiscuzOptions.php:391
WpdiscuzOptions->__construct()
wp-content/plugins/wpdiscuz/options/class.WpdiscuzOptions.php:63
WpdiscuzCore->__construct()
wp-content/plugins/wpdiscuz/class.WpdiscuzCore.php:94
WpdiscuzCore::getInstance()
wp-content/plugins/wpdiscuz/class.WpdiscuzCore.php:194
wpDiscuz()
wp-content/plugins/wpdiscuz/utils/functions.php:8

 

this is currently adding about 5 megs a minute to my error log.

 

Reply
2 Replies
Asti
 Asti
Support
(@asti)
Joined: 8 years ago

Illustrious Member
Posts: 8000

@epikfrost 

If you send the admin login details to info[at]gvectots.com email address. I'll ask the developers to check the issue for you.

Reply
(@epikfrost)
Joined: 2 months ago

New Member
Posts: 2

@asti I am not going to do that. This has been a bug since January, is anyone working on it?

Reply
Share: