[wp-trac] [WordPress Trac] #62337: i18n: Translation is not applied in load_theme_textdomain() function
WordPress Trac
noreply at wordpress.org
Fri Nov 8 14:03:53 UTC 2024
#62337: i18n: Translation is not applied in load_theme_textdomain() function
--------------------------------------+-------------------------
Reporter: wildworks | Owner: swissspidy
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 6.7.1
Component: I18N | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-------------------------
Comment (by twvania):
Hi @swissspidy,
In RC4, the translation already works for the standard pattern in the Site
Editor, but the issue remains on the front-end.
Here’s how you can see the bug:
1) Create a pattern called `hidden-404.php` with the following code:
{{{
<?php
/**
* Title: 404
* Slug: theme-name/hidden-404
* Inserter: no
*/
?>
<!-- wp:heading {"level":1} -->
<h1 class="wp-block-heading"><?php echo esc_attr_x( 'Page not found', '404
error page', 'theme-name' ); ?></h1>
<!-- /wp:heading -->
}}}
2) Create a `404.html` template with the following code:
{{{
<!-- wp:pattern {"slug":"theme-name/hidden-404"} /-->
}}}
3) If you navigate to the 404 page on the front-end, the translation
doesn’t work.
4) If you open this page in the Site Editor, it works (after RC4 fixes),
but to make it work on the front-end, you need to save this template to
the database.
Either I’m doing something wrong, or the translation should work for
templates pulled from the code rather than the database.
P.S. `load_theme_textdomain` trying on `init`/`after_setup_theme` action.
Thank you in advance for your time,
Regards
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62337#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list