Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    Hello,

    The best way to proceed is to use the same way as WordPress itself often does using _x(). Here the string is not the same for the name and singular name, however using a different context (the second param of _x() would allow to differentiate the 2 strings. This is in fact the exact reason for the existence of this function.

    Thread Starter lagunas

    (@lagunas)

    Thanks for your answer!

    This is my code (in a custom plugin):

    register_post_type('series',
        array(
            'labels'      => array(
                'name'          => _x('Series', 'plural', 'customcpt'),
                'singular_name' => _x('Series', 'singular', 'customcpt'),
            ),
            'public'      => true,
            'has_archive' => true,
        )
    );

    From your answer I understand that it should work, but the string ‘Series’ is only showing up once.

    I’m also using Theme and plugin translation for Polylang (TTfP) extension to translate strings directly from WordPress, since I don’t have experience with .pot files and I only need to translate a couple of words. Maybe the problem is there?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Same string in one language with multiple translations in custom post type name’ is closed to new replies.