mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
I18n for custom taxonomies. Fixes #13357
git-svn-id: https://develop.svn.wordpress.org/trunk@14614 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -281,7 +281,10 @@ function _wp_ajax_add_hierarchical_term() {
|
||||
}
|
||||
|
||||
ob_start();
|
||||
wp_dropdown_categories( array( 'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => sprintf( __('— Parent %s —'), $taxonomy->singular_label ) ) );
|
||||
wp_dropdown_categories( array(
|
||||
'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name',
|
||||
'hierarchical' => 1, 'show_option_none' => '— '.$taxonomy->labels->parent_item.' —'
|
||||
) );
|
||||
$sup = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$add['supplemental'] = array( 'newcat_parent' => $sup );
|
||||
|
||||
@@ -112,7 +112,7 @@ foreach ( get_object_taxonomies($post_type) as $tax_name ) {
|
||||
if ( ! $taxonomy->show_ui )
|
||||
continue;
|
||||
|
||||
$label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;
|
||||
$label = $taxonomy->labels->name;
|
||||
|
||||
if ( !is_taxonomy_hierarchical($tax_name) )
|
||||
add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', $post_type, 'side', 'core');
|
||||
|
||||
@@ -24,7 +24,7 @@ do_action($taxonomy . '_pre_edit_form', $tag, $taxonomy); ?>
|
||||
|
||||
<div class="wrap">
|
||||
<?php screen_icon(); ?>
|
||||
<h2><?php printf(_x('Edit %s', '%s: singular taxonomy name'), $tax->singular_label); ?></h2>
|
||||
<h2><?php echo $tax->labels->edit_item; ?></h2>
|
||||
<div id="ajax-response"></div>
|
||||
<form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate">
|
||||
<input type="hidden" name="action" value="editedtag" />
|
||||
@@ -75,6 +75,6 @@ else
|
||||
do_action('edit_tag_form', $tag);
|
||||
do_action($taxonomy . '_edit_form', $tag, $taxonomy);
|
||||
?>
|
||||
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo esc_attr( sprintf(_x('Update %s', '%s: singular taxonomy name'), $tax->singular_label)); ?>" /></p>
|
||||
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo esc_attr( __( 'Update' ) ); ?>" /></p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,7 @@ if ( !is_taxonomy($taxonomy) )
|
||||
|
||||
$tax = get_taxonomy($taxonomy);
|
||||
|
||||
$title = $tax->label;
|
||||
$title = $tax->labels->name;
|
||||
|
||||
if ( empty($post_type) || !in_array( $post_type, get_post_types( array('public' => true) ) ) )
|
||||
$post_type = 'post';
|
||||
@@ -116,7 +116,7 @@ case 'bulk-delete':
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$title = sprintf(_x('Edit %s', '%s: singular taxonomy name'), $tax->singular_label);
|
||||
$title = $tax->labels->edit_item;
|
||||
|
||||
require_once ('admin-header.php');
|
||||
$tag_ID = (int) $_GET['tag_ID'];
|
||||
@@ -192,9 +192,9 @@ endif; ?>
|
||||
<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
|
||||
<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="tag-search-input"><?php printf(_x('Search %s', '%s: plural taxonomy name'), $tax->label); ?>:</label>
|
||||
<label class="screen-reader-text" for="tag-search-input"><?php echo $tax->labels->search_items; ?>:</label>
|
||||
<input type="text" id="tag-search-input" name="s" value="<?php _admin_search_query(); ?>" />
|
||||
<input type="submit" value="<?php echo esc_attr( sprintf(_x('Search %s', '%s: plural taxonomy name'), $tax->label) ); ?>" class="button" />
|
||||
<input type="submit" value="<?php echo esc_attr( $tax->labels->search_items ); ?>" class="button" />
|
||||
</p>
|
||||
</form>
|
||||
<br class="clear" />
|
||||
@@ -326,7 +326,7 @@ else
|
||||
if ( $tag_cloud ) :
|
||||
?>
|
||||
<div class="tagcloud">
|
||||
<h3><?php printf(_x('Popular %s', '%s: plural taxonomy name'), $tax->label); ?></h3>
|
||||
<h3><?php echo $tax->labels->popular_items; ?></h3>
|
||||
<?php echo $tag_cloud; unset( $tag_cloud ); ?>
|
||||
</div>
|
||||
<?php
|
||||
@@ -341,7 +341,7 @@ if ( current_user_can($tax->cap->edit_terms) ) {
|
||||
?>
|
||||
|
||||
<div class="form-wrap">
|
||||
<h3><?php printf(_x('Add a New %s', '%s: singular taxonomy name'), $tax->singular_label); ?></h3>
|
||||
<h3><?php echo $tax->labels->add_new_item; ?></h3>
|
||||
<form id="addtag" method="post" action="edit-tags.php" class="validate">
|
||||
<input type="hidden" name="action" value="add-tag" />
|
||||
<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
|
||||
@@ -379,7 +379,7 @@ if ( ! is_taxonomy_hierarchical($taxonomy) )
|
||||
do_action('add_tag_form_fields', $taxonomy);
|
||||
do_action($taxonomy . '_add_form_fields', $taxonomy);
|
||||
?>
|
||||
<p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php echo esc_attr(sprintf(_x('Add %s', '%s: singular taxonomy name'), $tax->singular_label)); ?>" /></p>
|
||||
<p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" /></p>
|
||||
<?php
|
||||
if ( 'category' == $taxonomy )
|
||||
do_action('edit_category_form', (object)array('parent' => 0) ); // Back compat hook. Deprecated in preference to $taxonomy_add_form
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ foreach ( (array) $authors as $author ) {
|
||||
<?php foreach ( get_taxonomies( array( 'show_ui' => true ), 'objects' ) as $tax_obj ) {
|
||||
$term_dropdown = wp_dropdown_categories( array( 'taxonomy' => $tax_obj->name, 'hide_if_empty' => true, 'show_option_all' => __( 'All Terms' ), 'name' => 'taxonomy[' . $tax_obj->name . ']', 'id' => 'taxonomy-' . $tax_obj->name, 'class' => '', 'echo' => false ) );
|
||||
if ( $term_dropdown )
|
||||
echo '<label for="taxonomy-' . $tax_obj->name . '">' . $tax_obj->label . '</label>: ' . $term_dropdown . '<br/>';
|
||||
echo '<label for="taxonomy-' . $tax_obj->name . '">' . $tax_obj->labels->name . '</label>: ' . $term_dropdown . '<br/>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
@@ -296,7 +296,7 @@ function post_categories_meta_box( $post, $box ) {
|
||||
?>
|
||||
<div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">
|
||||
<ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs">
|
||||
<li class="tabs"><a href="#<?php echo $taxonomy; ?>-all" tabindex="3"><?php printf( __( 'All %s' ), $tax->label ); ?></a></li>
|
||||
<li class="tabs"><a href="#<?php echo $taxonomy; ?>-all" tabindex="3"><?php echo $tax->labels->all_items; ?></a></li>
|
||||
<li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?>-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
|
||||
</ul>
|
||||
|
||||
@@ -320,11 +320,22 @@ function post_categories_meta_box( $post, $box ) {
|
||||
<?php endif; ?>
|
||||
<?php if ( current_user_can($tax->cap->edit_terms) ) : ?>
|
||||
<div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children">
|
||||
<h4><a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js" tabindex="3"><?php printf( __( '+ Add New %s' ), $tax->singular_label ); ?></a></h4>
|
||||
<h4>
|
||||
<a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js" tabindex="3">
|
||||
<?php
|
||||
/* translators: %s: add new taxonomy label */
|
||||
printf( __( '+ %s' ), $tax->labels->add_new_item );
|
||||
?>
|
||||
</a>
|
||||
</h4>
|
||||
<p id="<?php echo $taxonomy; ?>-add" class="category-add wp-hidden-child">
|
||||
<label class="screen-reader-text" for="new<?php echo $taxonomy; ?>"><?php printf( __( 'Add New %s' ), $tax->singular_label ); ?></label><input type="text" name="new<?php echo $taxonomy; ?>" id="new<?php echo $taxonomy; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( sprintf( 'New %s Name', $tax->singular_label ) ); ?>" tabindex="3" aria-required="true"/>
|
||||
<label class="screen-reader-text" for="new<?php echo $taxonomy; ?>_parent"><?php printf( __('Parent %s'), $tax->singular_label ); ?>:</label><?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => sprintf( __('— Parent %s —'), $tax->singular_label ), 'tab_index' => 3 ) ); ?>
|
||||
<input type="button" id="<?php echo $taxonomy; ?>-add-submit" class="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add button category-add-sumbit" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
|
||||
<label class="screen-reader-text" for="new<?php echo $taxonomy; ?>"><?php echo $tax->labels->add_new_item; ?></label>
|
||||
<input type="text" name="new<?php echo $taxonomy; ?>" id="new<?php echo $taxonomy; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" tabindex="3" aria-required="true"/>
|
||||
<label class="screen-reader-text" for="new<?php echo $taxonomy; ?>_parent">
|
||||
<?php echo $tax->labels->parent_item_colon; ?>
|
||||
</label>
|
||||
<?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —', 'tab_index' => 3 ) ); ?>
|
||||
<input type="button" id="<?php echo $taxonomy; ?>-add-submit" class="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add button category-add-sumbit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" tabindex="3" />
|
||||
<?php wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce', false ); ?>
|
||||
<span id="<?php echo $taxonomy; ?>-ajax-response"></span>
|
||||
</p>
|
||||
|
||||
@@ -391,7 +391,7 @@ function wp_nav_menu_taxonomy_meta_boxes() {
|
||||
$tax = apply_filters( 'nav_menu_meta_box_object', $tax );
|
||||
if ( $tax ) {
|
||||
$id = $tax->name;
|
||||
add_meta_box( "add-{$id}", $tax->label, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
|
||||
add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ function inline_edit_term_row($type, $taxonomy) {
|
||||
|
||||
<p class="inline-edit-save submit">
|
||||
<a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a>
|
||||
<?php $update_text = sprintf( __('Update %s'), $tax->singular_label ); ?>
|
||||
<?php $update_text = $tax->labels->update_item; ?>
|
||||
<a accesskey="s" href="#inline-edit" title="<?php echo esc_attr( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>
|
||||
<img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
|
||||
<span class="error" style="display:none;"></span>
|
||||
@@ -976,7 +976,7 @@ if ( !$bulk ) :
|
||||
|
||||
<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
|
||||
|
||||
<span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->label) ?>
|
||||
<span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->labels->name) ?>
|
||||
<span class="catshow"><?php _e('[more]'); ?></span>
|
||||
<span class="cathide" style="display:none;"><?php _e('[less]'); ?></span>
|
||||
</span>
|
||||
@@ -1040,7 +1040,7 @@ endif; // $post_type_object->hierarchical ?>
|
||||
<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
|
||||
|
||||
<label class="inline-edit-tags">
|
||||
<span class="title"><?php echo esc_html($taxonomy->label) ?></span>
|
||||
<span class="title"><?php echo esc_html($taxonomy->labels->name) ?></span>
|
||||
<textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr($taxonomy->name)?>]" class="tax_input_<?php echo esc_attr($taxonomy->name)?>"></textarea>
|
||||
</label>
|
||||
|
||||
@@ -1566,7 +1566,7 @@ foreach ( $posts_columns as $column_name => $column_display_name ) {
|
||||
$attributes = 'class="post-title page-title column-title"' . $style;
|
||||
$edit_link = get_edit_post_link( $page->ID );
|
||||
?>
|
||||
<td <?php echo $attributes ?>><strong><?php if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . $post_type_object->labels->parent . ' ' . esc_html($parent_name) : ''; ?></strong>
|
||||
<td <?php echo $attributes ?>><strong><?php if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html($parent_name) : ''; ?></strong>
|
||||
<?php
|
||||
$actions = array();
|
||||
if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) {
|
||||
@@ -3762,7 +3762,7 @@ function screen_options($screen) {
|
||||
break;
|
||||
case 'edit-tags':
|
||||
global $tax;
|
||||
$per_page_label = $tax->label;
|
||||
$per_page_label = $tax->labels->name;
|
||||
break;
|
||||
case 'plugins':
|
||||
$per_page_label = __('Plugins');
|
||||
|
||||
+2
-2
@@ -89,7 +89,7 @@ $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu
|
||||
if ( ! $tax->show_ui || ! in_array('post', (array) $tax->object_type, true) )
|
||||
continue;
|
||||
|
||||
$submenu['edit.php'][$i++] = array( esc_attr($tax->label), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
|
||||
$submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
|
||||
}
|
||||
unset($tax);
|
||||
|
||||
@@ -138,7 +138,7 @@ foreach ( (array) get_post_types( array('show_ui' => true) ) as $ptype ) {
|
||||
if ( ! $tax->show_ui || ! in_array($ptype, (array) $tax->object_type, true) )
|
||||
continue;
|
||||
|
||||
$submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr($tax->label), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" );
|
||||
$submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" );
|
||||
}
|
||||
}
|
||||
unset($ptype, $ptype_obj);
|
||||
|
||||
+13
-5
@@ -488,7 +488,7 @@ var photostorage = false;
|
||||
<div id="taxonomy-category" class="categorydiv">
|
||||
|
||||
<ul id="category-tabs" class="category-tabs">
|
||||
<li class="tabs"><a href="#category-all" tabindex="3"><?php printf( __( 'All %s' ), $tax->label ); ?></a></li>
|
||||
<li class="tabs"><a href="#category-all" tabindex="3"><?php echo $tax->labels->all_items; ?></a></li>
|
||||
<li class="hide-if-no-js"><a href="#category-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
|
||||
</ul>
|
||||
|
||||
@@ -509,11 +509,19 @@ var photostorage = false;
|
||||
<?php endif; ?>
|
||||
<?php if ( current_user_can($tax->cap->edit_terms) ) : ?>
|
||||
<div id="category-adder" class="wp-hidden-children">
|
||||
<h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php printf( __( '+ Add New %s' ), $tax->singular_label ); ?></a></h4>
|
||||
<h4>
|
||||
<a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3">
|
||||
<?php printf( __( '+ %s' ), $tax->labels->add_new_item ); ?>
|
||||
</a>
|
||||
</h4>
|
||||
<p id="category-add" class="category-add wp-hidden-child">
|
||||
<label class="screen-reader-text" for="newcategory"><?php printf( __( 'Add New %s' ), $tax->singular_label ); ?></label><input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( sprintf( 'New %s Name', $tax->singular_label ) ); ?>" tabindex="3" aria-required="true"/>
|
||||
<label class="screen-reader-text" for="newcategory_parent"><?php printf( __('Parent %s'), $tax->singular_label ); ?>:</label><?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => sprintf( __('— Parent %s —'), $tax->singular_label ), 'tab_index' => 3 ) ); ?>
|
||||
<input type="button" id="category-add-submit" class="add:categorychecklist:category-add button category-add-sumbit" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
|
||||
<label class="screen-reader-text" for="newcategory"><?php echo $tax->labels->add_new_item; ?></label>
|
||||
<input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" tabindex="3" aria-required="true"/>
|
||||
<label class="screen-reader-text" for="newcategory_parent">
|
||||
<?php echo $tax->labels->parent_item_colon; ?>
|
||||
</label>
|
||||
<?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —', 'tab_index' => 3 ) ); ?>
|
||||
<input type="button" id="category-add-submit" class="add:categorychecklist:category-add button category-add-sumbit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" tabindex="3" />
|
||||
<?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
|
||||
<span id="category-ajax-response"></span>
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user