php - Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defau

admin2025-01-08  3

Looks like this has been introduced in WordPress 6.7 - I have the following code:

$loaded = load_theme_textdomain(MY_TEXTDOMAIN,get_stylesheet_directory() . '/languages'); // internationalization

$locale = get_locale();

The locale is correct and available, load_them_textdomain() returns true but the language in the theme is English instead of German in this case.

Using de_DE_formal for the project. Did anyone experience a similar issue? How can it fail though the language is correctly loaded and set? Help would be really appreciated.

Looks like this has been introduced in WordPress 6.7 - I have the following code:

$loaded = load_theme_textdomain(MY_TEXTDOMAIN,get_stylesheet_directory() . '/languages'); // internationalization

$locale = get_locale();

The locale is correct and available, load_them_textdomain() returns true but the language in the theme is English instead of German in this case.

Using de_DE_formal for the project. Did anyone experience a similar issue? How can it fail though the language is correctly loaded and set? Help would be really appreciated.

Share Improve this question asked Nov 18, 2024 at 10:29 BlackbamBlackbam 56510 silver badges28 bronze badges 3
  • have you tried the translation call just after the call to get_locale ? – mmm Commented Nov 18, 2024 at 11:09
  • have you checked the WP Trac for a bug ticket? Note that this isn't a discussion forum it's a question answer site, you need to phrase your question so that someone would have to write an answer that you can mark as correct, not just a reply – Tom J Nowell Commented Nov 18, 2024 at 11:13
  • @mmm Good point. The translation call fails directly after the get_locale unfortunately. – Blackbam Commented Nov 18, 2024 at 16:31
Add a comment  | 

1 Answer 1

Reset to default 0

The comment of Tom J Nowell has pointed me into the correct direction here it looks like this is really WordPress bug: https://core.trac.wordpress.org/ticket/62337

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736269269a1338.html

最新回复(0)