• Resolved Pavel Mares

    (@pavelmares)


    Usually when I use PO/MO files, I can create custom names fot custom post types in other languages.

    With this plugin I can’t translate it. … Well, I can but then site is showing 404 error. Is this correct behaviour?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author marcinkazmierski

    (@marcinkazmierski)

    hi, could you paste your code snippet?

    Thread Starter Pavel Mares

    (@pavelmares)

    `public function cpt_investice_register() {
    $labels = array(
    ‘name’ => __( ‘Investments’, ‘investdesign’ ),
    ‘singular_name’ => __( ‘Invetment’, ‘investdesign’ ),
    ‘menu_name’ => __( ‘Investments’, ‘investdesign’ ),
    ‘name_admin_bar’ => __( ‘Investments’, ‘investdesign’ ),
    ‘add_new’ => __( ‘Add investment’, ‘investdesign’ ),
    ‘add_new_item’ => __( ‘Add investment’, ‘investdesign’ ),
    ‘new_item’ => __( ‘New investment’, ‘investdesign’ ),
    ‘edit_item’ => __( ‘Edit investment’, ‘investdesign’ ),
    ‘view_item’ => __( ‘View investment’, ‘investdesign’ ),
    ‘view_items’ => __( ‘View investments’, ‘investdesign’ ),
    ‘all_items’ => __( ‘All investments’, ‘investdesign’ ),
    ‘search_items’ => __( ‘Search investments’, ‘investdesign’ ),
    ‘parent_item_colon’ => __( ‘Parent investment:’, ‘investdesign’ ),
    ‘not_found’ => __( ‘No investments found.’, ‘investdesign’ ),
    ‘not_found_in_trash’ => __( ‘No investments found in trash.’, ‘investdesign’ ),
    );

    $args = array(
    ‘labels’ => $labels,
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘show_ui’ => true,
    ‘show_in_menu’ => true,
    ‘query_var’ => true,
    ‘has_archive’ => __( ‘investments’, ‘investdesign’ ),
    ‘rewrite’ => array( ‘slug’ => __( ‘investment’, ‘investdesign’ ) ),
    ‘capability_type’ => ‘post’,
    ‘hierarchical’ => true,
    ‘menu_position’ => 42,
    ‘menu_icon’ => ‘dashicons-location-alt’,
    ‘supports’ => array( ‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’ ),
    );

    register_post_type( ‘investment’, $args );
    }

    Plugin Author marcinkazmierski

    (@marcinkazmierski)

    ok, I checked it – this is not a problem with my plugin, my plugin supports text translation in functions like __() – and this is works fine.

    when you change slug you have to refresh cache to override it (flush_rewrite_rules()).

    Maybe you should use something like this:
    https://pl.wordpress.org/plugins/wp-slug-post-type-custom-language/
    ?

    Thread Starter Pavel Mares

    (@pavelmares)

    Yeah, I updated permalinks (which uses flush_rewrite_rules()). I hoped I can translate slug of custom post type via this plugin.

    I have this:

    ‘has_archive’ => __( ‘investments’, ‘investdesign’ ),
    ‘rewrite’ => array( ‘slug’ => __( ‘investment’, ‘investdesign’ ) ),

    For purpose of translations and it works via PO/MO files. But not via this plugin on polylang string translations.

    If it should not work, ok. Just asking if this is not a bug (and it should be working).

    Plugin Author marcinkazmierski

    (@marcinkazmierski)

    ok, thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Translate slug’ is closed to new replies.