• I’m localizing a theme i’m working on. The localization works fine except for the taxonomies and the custom post types. Both keep displaying in the default language.

    Anyone who can tell me what could be the reason for that?

    This is the function I use for the taxonomy:

    function build_taxonomies(){
    	register_taxonomy(
    	__( "skill-type" ),
    	array(__( "portfolio" )),
    	array(
    	"hierarchical" => true,
    	"label" => __( "Skill Types" ),
    	"singular_label" => __( "Skill Type" ),
    	"rewrite" => array('slug' => 'skill-type', 'hierarchical' => true)));
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator t-p

    (@t-p)

    Thread Starter xytras

    (@xytras)

    I’ve read the codex guides… It looks like i’m doing it the right way.
    I haven’t found a solution yet. Anyone?

    A dirty fix is to create a replacement for the wordpress function: wp_list_categories
    then hard type the tags name and translate them as normal text in your websie.

    Try it this way:

    add_action( 'init', 'create_my_taxonomies', 0 );
    
    //create taxonomies
    function create_my_taxonomies()
    {
      // Add new taxonomy
      $labels = array(
        'name' => __( 'Samples', 'mythemename' ),
        'singular_name' => __( 'Sample', 'mythemename' ),
        'search_items' =>  __( 'Search Samples', 'mythemename' ),
        'all_items' => __( 'All Samples', 'mythemename' ),
        'parent_item' => __( 'Parent Sample', 'mythemename' ),
        'parent_item_colon' => __( 'Parent Sample:', 'mythemename' ),
        'edit_item' => __( 'Edit Sample', 'mythemename' ),
        'update_item' => __( 'Update Sample', 'mythemename' ),
        'add_new_item' => __( 'Add New Sample', 'mythemename' ),
        'new_item_name' => __( 'New Sample Name', 'mythemename' ),
        'menu_name' => __( 'Samples', 'mythemename' ),
      ); 	
    
      register_taxonomy('sample',array('mycustomposttype'), array(
        'hierarchical' => true,
        'labels' => $labels,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'sample' ),
      ));
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Localization of taxonomies’ is closed to new replies.