Make WordPress Core

Opened 5 months ago

Closed 5 months ago

#62736 closed defect (bug) (invalid)

Internationalization improvements in 6.7 possible bug

Reported by: fullermetric's profile fullermetric Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.7.1
Component: General Keywords:
Focuses: Cc:

Description

In our functions.php we have this going on:

if (function_exists('add_theme_support')) {

load_theme_textdomain('html5blank', get_template_directory() . '/languages');

}

which used to work, but now generates a message in our debug.log

[23-Dec-2024 22:40:13 UTC] PHP Notice: Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>html5blank</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. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in /chroot/home/ab2bb14c/fullerfasteners.com/html/wp-includes/functions.php on line 6114

Have a look at this thread https://core.trac.wordpress.org/changeset/59127
and tell us if we are doing this correctly?

Thanks,
Fuller

Change History (2)

#1 @abcd95
5 months ago

Hi @fullermetric, Thank you for reporting this issue.

This is a known issue. I recommend going through this to get a better understanding (related) - #44937, #62723.

Related dev blog - https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/

For now, you can ensure load_theme_textdomain() is called at or after the init hook.

#2 @swissspidy
5 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

In our functions.php we have this going on:

You should only run this code on the after_setup_theme hook, not directly.

See https://developer.wordpress.org/themes/advanced-topics/internationalization/#how-to-internationalize-your-theme

Note: See TracTickets for help on using tickets.