[wp-trac] [WordPress Trac] #56059: register_post_type()'s "description" argument can't be translated (gettext)

WordPress Trac noreply at wordpress.org
Sat Jun 25 12:48:34 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             |  Resolution:
 Keywords:                     |     Focuses:

Comment (by SergeyBiryukov):

 Replying to [comment:3 andreacalligaris]:
 > If I copy-paste the following code from my first post:
 > {{{#!php
 > <?php esc_html__("This is a beautiful description for this post type,
 but sadly it doesn't get translated", 'text_domain');
 > }}}
 > and I ''echo'' it in e.g. my sidebar, it gets correctly translated.
 > However, when assigned to "description", it is not. It's weird for sure,
 but I cannot see what I'm doing wrong.

 1. Can you check whether that string is translated by the time it is
 assigned to `description`?
 2. At that time exactly does the `register_post_type()` call run?

 I think this might be a priority issue, e.g. the post type is being
 registered before the locale is set up or the text domain is loaded.

Ticket URL: <https://core.trac.wordpress.org/ticket/56059#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list