Search code examples
wordpressgettextslug

Gettext fails in translating post type format permalink slug


I'm not that familiar with PHP so far but already succeeded in registring a custom post type. Now I'd like to make the permalink slug of it translatable. My theme already has correctly working localization files (based on twenty ten) and I see a lot of working strings in it. So I thought I could use the seen syntax but it will not translate (despite of having all the gettext files ready and relaunching MAMP).

add_action('init', 'create_post_type'); 
function create_post_type() {  
    register_post_type(
        'new_magazine_issue', 
        array(
            'labels' => array(
                     'name' => __('Magazine issue overviews', 'verwaltungsrundschau'),  
                 'singular_name' => __('Magazine issue overview', 'verwaltungsrundschau')
                 ),
        'public' => true,  
        'show_ui' => true,  
        'supports' => array( 'title', 'editor', 'post-thumbnails', 'custom-fields', 'revisions'),
        'rewrite' => array( 'slug' => __('magazine-issue-overviews', 'verwaltungsrundschau') )
        )  

    );  

}

Can't it be done like this simply? 'name' and 'singular_name' translation works as well as all others but this one doesn't


Solution

  • Okay, finaly found it out! It had to be like this:

    'rewrite' => array( 'slug' => __('magazine-issue-overviews', 'verwaltungsrundschau'), 'with_front' => FALSE),