[wp-trac] [WordPress Trac] #56059: register_post_type()'s "description" argument can't be translated (gettext)
WordPress Trac
noreply at wordpress.org
Fri Jun 24 00:25:17 UTC 2022
#56059: register_post_type()'s "description" argument can't be translated (gettext)
-------------------------------+-----------------------------
Reporter: andreacalligaris | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 6.0
Severity: normal | Keywords:
Focuses: |
-------------------------------+-----------------------------
Calling ''register_post_type'' it is possible to use ''gettext'' to
translate the labels of the post type.
However, while the labels do work, the argument ''"description"'' doesn't
translate.
{{{#!php
<?php
...
$args['labels'] = array(
'name' => __('Books', 'text_domain'),
'singular_name' => __('Book', 'text_domain'),
'add_new' => 'New Book' );
$args['description'] = esc_html__("This is a beautiful description for
this post type, but sadly it doesn't get translated", 'text_domain');
$args['has_archive'] = 'books';
...
?>
}}}
I'm rather sure that it's not some mistake of mine, because I checked the
''.po'' and ''.mo'' files multiple times and if I copy and paste that
gettext line of code and I echo it anywhere on my website, it gets
correctly translated. So it's something about the ''"description"''
parameter.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56059>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list