Opened 10 years ago
Closed 8 years ago
#27524 closed defect (bug) (invalid)
The titles of columns in the admin aren't translated with custom post types and custom taxonomies
Reported by: | benoitchantre | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.8.1 |
Component: | I18N | Keywords: | reporter-feedback close |
Focuses: | administration | Cc: |
Description
When you add a custom post type or a custom taxonomy, there's a specific column added to the table in the admin.
The titles of the columns that are added appears in plain english, even if the term is already included in the language file.
Change History (13)
#3
follow-up:
↓ 6
@
10 years ago
Could you provide your post type registration code to reproduce the issue?
#4
in reply to:
↑ 1
@
10 years ago
Replying to johnbillion:
Thanks for the report benoitchantre.
What is the title of the affected column?
The title is specific to my theme, but it's the column next to "Title".
In my case, it's title is "Places", because I have a custom taxonomy "Places" that is tied to a custom post type.
In the table concerning the custom taxonomy, the last column contains the name (in plain english) of the custom post type.
#5
@
10 years ago
I have also noticed that the main title above the table is in plain english instead of the translation.
#6
in reply to:
↑ 3
@
10 years ago
Replying to SergeyBiryukov:
Could you provide your post type registration code to reproduce the issue?
Here's my code
/** * Register Custom Taxonomy. */ function ts_place_taxonomy() { $labels = array( 'name' => _x( 'Places', 'Taxonomy General Name', 'mydomain' ), 'singular_name' => _x( 'Place', 'Taxonomy Singular Name', 'mydomain' ), 'menu_name' => __( 'Places', 'mydomain' ), 'all_items' => __( 'All Places', 'mydomain' ), 'parent_item' => __( 'Parent Place', 'mydomain' ), 'parent_item_colon' => __( 'Parent Place:', 'mydomain' ), 'new_item_name' => __( 'New Place Name', 'mydomain' ), 'add_new_item' => __( 'Add New Place', 'mydomain' ), 'edit_item' => __( 'Edit Place', 'mydomain' ), 'update_item' => __( 'Update Place', 'mydomain' ), 'separate_items_with_commas' => __( 'Separate places with commas', 'mydomain' ), 'search_items' => __( 'Search Places', 'mydomain' ), 'add_or_remove_items' => __( 'Add or remove places', 'mydomain' ), 'choose_from_most_used' => __( 'Choose from the most used places', 'mydomain' ), ); $args = array( 'labels' => $labels, 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => false, 'show_tagcloud' => false, 'meta_box_cb' => false, ); register_taxonomy( 'ts_place', 'ts_animal', $args ); } // Hook into the 'init' action add_action( 'init', 'ts_place_taxonomy', 0 ); /** * Register Custom Post Type. */ function ts_animal_post_type() { $labels = array( 'name' => _x( 'Animals', 'Post Type General Name', 'mydomain' ), 'singular_name' => _x( 'Animal', 'Post Type Singular Name', 'mydomain' ), 'menu_name' => __( 'Animals', 'mydomain' ), 'parent_item_colon' => __( 'Parent Animal:', 'mydomain' ), 'all_items' => __( 'All Animals', 'mydomain' ), 'view_item' => __( 'View Animal', 'mydomain' ), 'add_new_item' => __( 'Add New Animal', 'mydomain' ), 'add_new' => __( 'New Animal', 'mydomain' ), 'edit_item' => __( 'Edit Animal', 'mydomain' ), 'update_item' => __( 'Update Animal', 'mydomain' ), 'search_items' => __( 'Search animals', 'mydomain' ), 'not_found' => __( 'No animals found', 'mydomain' ), 'not_found_in_trash' => __( 'No animals found in Trash', 'mydomain' ), ); $args = array( 'label' => __( 'animal', 'mydomain' ), 'description' => __( 'Animal information pages', 'mydomain' ), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'page-attributes', 'thumbnail', 'revisions'), 'taxonomies' => array( 'species' ), 'hierarchical' => true, 'public' => true, 'rewrite' => array('slug' => __( 'animals', 'mydomain' )), 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => false, 'show_in_admin_bar' => true, 'menu_position' => 20, 'menu_icon' => '', 'can_export' => true, 'has_archive' => false, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'page', ); register_post_type( 'ts_animal', $args ); } // Hook into the 'init' action add_action( 'init', 'ts_animal_post_type', 0 );
#7
@
10 years ago
I'm not yet able to reproduce the issue with the code above using current trunk, Twenty Fourteen, and no plugins except for Pig Latin to test the strings.
When I go to wp-admin/edit-tags.php?taxonomy=ts_place&post_type=ts_animal
, the Animal column is translated.
@benoitchantre - are you using a modified version of the code above, or do you have any plugins installed? Also, does this happen in current trunk or is this a 3.8.1 installation?
#8
@
10 years ago
- Version changed from trunk to 3.8.1
Sorry, I haven choosen the wrong option. I saw it in the 3.8.1 version.
It's not related to a plugin, I have tested that on a fresh install of the version 3.8.1 without any plugin: only the theme I'm developing that contains the code above.
#9
follow-up:
↓ 10
@
10 years ago
benoitchantre: Where is your translation coming from? Is it in a language file with the same textdomain as your plugin ("mydomain")? Or is it a translation in your theme with a different textdomain?
#10
in reply to:
↑ 9
@
10 years ago
Replying to johnbillion:
benoitchantre: Where is your translation coming from? Is it in a language file with the same textdomain as your plugin ("mydomain")? Or is it a translation in your theme with a different textdomain?
The translation comes from a .mo file in my theme.
It is loaded by this line of code in functions.php
The textdomain is always the same (not mydomain, but the name of the theme ; I used mydomain only in this ticket to have a neutral name).
load_theme_textdomain( 'mydomain', get_template_directory() . '/languages' );
Note: there's no plugin installed, only my custom theme based on _s from Automattic.
Thanks for the report benoitchantre.
What is the title of the affected column?