<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[53058] trunk/src/wp-includes: Posts, Post Types; Taxonomy: Translate default labels once.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/53058">53058</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/53058","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>peterwilsoncc</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-04-04 03:48:08 +0000 (Mon, 04 Apr 2022)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Posts, Post Types; Taxonomy: Translate default labels once.

Improve the translation of post type and taxonomy labels by caching the translations during runtime. To account for internationalisation plugins, the runtime cache is cleared as the post types/taxonomies are reinitiated on `change_local` hook.

The same property and methods are added to both `WP_Post_Type` and `WP_Taxonomy`:

* `$default_labels`: for storing the translated strings at runtime
* `get_default_labels()`: for getting the default labels, these are translated on the first run and stored in the new property.
* `reset_default_labels()`: to clear the runtime cache and force a re-translation of the default labels

Props Chouby, nacin, SergeyBiryukov, Rarst, chriscct7, ocean90, audrasjb, costdev.
Fixes <a href="https://core.trac.wordpress.org/ticket/26746">#26746</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswpposttypephp">trunk/src/wp-includes/class-wp-post-type.php</a></li>
<li><a href="#trunksrcwpincludesclasswptaxonomyphp">trunk/src/wp-includes/class-wp-taxonomy.php</a></li>
<li><a href="#trunksrcwpincludespostphp">trunk/src/wp-includes/post.php</a></li>
<li><a href="#trunksrcwpincludestaxonomyphp">trunk/src/wp-includes/taxonomy.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswpposttypephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-post-type.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-post-type.php      2022-04-04 01:23:55 UTC (rev 53057)
+++ trunk/src/wp-includes/class-wp-post-type.php        2022-04-04 03:48:08 UTC (rev 53058)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -45,6 +45,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public $labels;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Default labels.
+        *
+        * @since 6.0.0
+        * @var (string|null)[][] $default_labels
+        */
+       protected static $default_labels = array();
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * A short descriptive summary of what the post type is.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * Default empty.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -785,4 +793,69 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $this->rest_controller;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * Returns the default labels for post types.
+        *
+        * @since 6.0.0
+        *
+        * @return (string|null)[][] The default labels for post types.
+        */
+       public static function get_default_labels() {
+               if ( ! empty( self::$default_labels ) ) {
+                       return self::$default_labels;
+               }
+
+               self::$default_labels = array(
+                       'name'                     => array( _x( 'Posts', 'post type general name' ), _x( 'Pages', 'post type general name' ) ),
+                       'singular_name'            => array( _x( 'Post', 'post type singular name' ), _x( 'Page', 'post type singular name' ) ),
+                       'add_new'                  => array( _x( 'Add New', 'post' ), _x( 'Add New', 'page' ) ),
+                       'add_new_item'             => array( __( 'Add New Post' ), __( 'Add New Page' ) ),
+                       'edit_item'                => array( __( 'Edit Post' ), __( 'Edit Page' ) ),
+                       'new_item'                 => array( __( 'New Post' ), __( 'New Page' ) ),
+                       'view_item'                => array( __( 'View Post' ), __( 'View Page' ) ),
+                       'view_items'               => array( __( 'View Posts' ), __( 'View Pages' ) ),
+                       'search_items'             => array( __( 'Search Posts' ), __( 'Search Pages' ) ),
+                       'not_found'                => array( __( 'No posts found.' ), __( 'No pages found.' ) ),
+                       'not_found_in_trash'       => array( __( 'No posts found in Trash.' ), __( 'No pages found in Trash.' ) ),
+                       'parent_item_colon'        => array( null, __( 'Parent Page:' ) ),
+                       'all_items'                => array( __( 'All Posts' ), __( 'All Pages' ) ),
+                       'archives'                 => array( __( 'Post Archives' ), __( 'Page Archives' ) ),
+                       'attributes'               => array( __( 'Post Attributes' ), __( 'Page Attributes' ) ),
+                       'insert_into_item'         => array( __( 'Insert into post' ), __( 'Insert into page' ) ),
+                       'uploaded_to_this_item'    => array( __( 'Uploaded to this post' ), __( 'Uploaded to this page' ) ),
+                       'featured_image'           => array( _x( 'Featured image', 'post' ), _x( 'Featured image', 'page' ) ),
+                       'set_featured_image'       => array( _x( 'Set featured image', 'post' ), _x( 'Set featured image', 'page' ) ),
+                       'remove_featured_image'    => array( _x( 'Remove featured image', 'post' ), _x( 'Remove featured image', 'page' ) ),
+                       'use_featured_image'       => array( _x( 'Use as featured image', 'post' ), _x( 'Use as featured image', 'page' ) ),
+                       'filter_items_list'        => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ),
+                       'filter_by_date'           => array( __( 'Filter by date' ), __( 'Filter by date' ) ),
+                       'items_list_navigation'    => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ),
+                       'items_list'               => array( __( 'Posts list' ), __( 'Pages list' ) ),
+                       'item_published'           => array( __( 'Post published.' ), __( 'Page published.' ) ),
+                       'item_published_privately' => array( __( 'Post published privately.' ), __( 'Page published privately.' ) ),
+                       'item_reverted_to_draft'   => array( __( 'Post reverted to draft.' ), __( 'Page reverted to draft.' ) ),
+                       'item_scheduled'           => array( __( 'Post scheduled.' ), __( 'Page scheduled.' ) ),
+                       'item_updated'             => array( __( 'Post updated.' ), __( 'Page updated.' ) ),
+                       'item_link'                => array(
+                               _x( 'Post Link', 'navigation link block title' ),
+                               _x( 'Page Link', 'navigation link block title' ),
+                       ),
+                       'item_link_description'    => array(
+                               _x( 'A link to a post.', 'navigation link block description' ),
+                               _x( 'A link to a page.', 'navigation link block description' ),
+                       ),
+               );
+
+               return self::$default_labels;
+       }
+
+       /**
+        * Resets the cache for the default labels.
+        *
+        * @since 6.0.0
+        */
+       public static function reset_default_labels() {
+               self::$default_labels = array();
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesclasswptaxonomyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-taxonomy.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-taxonomy.php       2022-04-04 01:23:55 UTC (rev 53057)
+++ trunk/src/wp-includes/class-wp-taxonomy.php 2022-04-04 03:48:08 UTC (rev 53058)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -43,6 +43,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public $labels;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Default labels.
+        *
+        * @since 6.0.0
+        * @var (string|null)[][] $default_labels
+        */
+       protected static $default_labels = array();
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * A short descriptive summary of what the taxonomy is for.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 4.7.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -562,4 +570,71 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $this->rest_controller;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * Returns the default labels for taxonomies.
+        *
+        * @since 6.0.0
+        *
+        * @return (string|null)[][] The default labels for taxonomies.
+        */
+       public static function get_default_labels() {
+               if ( ! empty( self::$default_labels ) ) {
+                       return self::$default_labels;
+               }
+
+               $name_field_description   = __( 'The name is how it appears on your site.' );
+               $slug_field_description   = __( 'The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' );
+               $parent_field_description = __( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' );
+               $desc_field_description   = __( 'The description is not prominent by default; however, some themes may show it.' );
+
+               self::$default_labels = array(
+                       'name'                       => array( _x( 'Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ),
+                       'singular_name'              => array( _x( 'Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ),
+                       'search_items'               => array( __( 'Search Tags' ), __( 'Search Categories' ) ),
+                       'popular_items'              => array( __( 'Popular Tags' ), null ),
+                       'all_items'                  => array( __( 'All Tags' ), __( 'All Categories' ) ),
+                       'parent_item'                => array( null, __( 'Parent Category' ) ),
+                       'parent_item_colon'          => array( null, __( 'Parent Category:' ) ),
+                       'name_field_description'     => array( $name_field_description, $name_field_description ),
+                       'slug_field_description'     => array( $slug_field_description, $slug_field_description ),
+                       'parent_field_description'   => array( null, $parent_field_description ),
+                       'desc_field_description'     => array( $desc_field_description, $desc_field_description ),
+                       'edit_item'                  => array( __( 'Edit Tag' ), __( 'Edit Category' ) ),
+                       'view_item'                  => array( __( 'View Tag' ), __( 'View Category' ) ),
+                       'update_item'                => array( __( 'Update Tag' ), __( 'Update Category' ) ),
+                       'add_new_item'               => array( __( 'Add New Tag' ), __( 'Add New Category' ) ),
+                       'new_item_name'              => array( __( 'New Tag Name' ), __( 'New Category Name' ) ),
+                       'separate_items_with_commas' => array( __( 'Separate tags with commas' ), null ),
+                       'add_or_remove_items'        => array( __( 'Add or remove tags' ), null ),
+                       'choose_from_most_used'      => array( __( 'Choose from the most used tags' ), null ),
+                       'not_found'                  => array( __( 'No tags found.' ), __( 'No categories found.' ) ),
+                       'no_terms'                   => array( __( 'No tags' ), __( 'No categories' ) ),
+                       'filter_by_item'             => array( null, __( 'Filter by category' ) ),
+                       'items_list_navigation'      => array( __( 'Tags list navigation' ), __( 'Categories list navigation' ) ),
+                       'items_list'                 => array( __( 'Tags list' ), __( 'Categories list' ) ),
+                       /* translators: Tab heading when selecting from the most used terms. */
+                       'most_used'                  => array( _x( 'Most Used', 'tags' ), _x( 'Most Used', 'categories' ) ),
+                       'back_to_items'              => array( __( '&larr; Go to Tags' ), __( '&larr; Go to Categories' ) ),
+                       'item_link'                  => array(
+                               _x( 'Tag Link', 'navigation link block title' ),
+                               _x( 'Category Link', 'navigation link block title' ),
+                       ),
+                       'item_link_description'      => array(
+                               _x( 'A link to a tag.', 'navigation link block description' ),
+                               _x( 'A link to a category.', 'navigation link block description' ),
+                       ),
+               );
+
+               return self::$default_labels;
+       }
+
+       /**
+        * Resets the cache for the default labels.
+        *
+        * @since 6.0.0
+        */
+       public static function reset_default_labels() {
+               self::$default_labels = array();
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludespostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/post.php    2022-04-04 01:23:55 UTC (rev 53057)
+++ trunk/src/wp-includes/post.php      2022-04-04 03:48:08 UTC (rev 53058)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,6 +18,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function create_initial_post_types() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        WP_Post_Type::reset_default_labels();
+
</ins><span class="cx" style="display: block; padding: 0 10px">         register_post_type(
</span><span class="cx" style="display: block; padding: 0 10px">                'post',
</span><span class="cx" style="display: block; padding: 0 10px">                array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1955,46 +1957,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @return object Object with all the labels as member variables.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function get_post_type_labels( $post_type_object ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $nohier_vs_hier_defaults = array(
-               'name'                     => array( _x( 'Posts', 'post type general name' ), _x( 'Pages', 'post type general name' ) ),
-               'singular_name'            => array( _x( 'Post', 'post type singular name' ), _x( 'Page', 'post type singular name' ) ),
-               'add_new'                  => array( _x( 'Add New', 'post' ), _x( 'Add New', 'page' ) ),
-               'add_new_item'             => array( __( 'Add New Post' ), __( 'Add New Page' ) ),
-               'edit_item'                => array( __( 'Edit Post' ), __( 'Edit Page' ) ),
-               'new_item'                 => array( __( 'New Post' ), __( 'New Page' ) ),
-               'view_item'                => array( __( 'View Post' ), __( 'View Page' ) ),
-               'view_items'               => array( __( 'View Posts' ), __( 'View Pages' ) ),
-               'search_items'             => array( __( 'Search Posts' ), __( 'Search Pages' ) ),
-               'not_found'                => array( __( 'No posts found.' ), __( 'No pages found.' ) ),
-               'not_found_in_trash'       => array( __( 'No posts found in Trash.' ), __( 'No pages found in Trash.' ) ),
-               'parent_item_colon'        => array( null, __( 'Parent Page:' ) ),
-               'all_items'                => array( __( 'All Posts' ), __( 'All Pages' ) ),
-               'archives'                 => array( __( 'Post Archives' ), __( 'Page Archives' ) ),
-               'attributes'               => array( __( 'Post Attributes' ), __( 'Page Attributes' ) ),
-               'insert_into_item'         => array( __( 'Insert into post' ), __( 'Insert into page' ) ),
-               'uploaded_to_this_item'    => array( __( 'Uploaded to this post' ), __( 'Uploaded to this page' ) ),
-               'featured_image'           => array( _x( 'Featured image', 'post' ), _x( 'Featured image', 'page' ) ),
-               'set_featured_image'       => array( _x( 'Set featured image', 'post' ), _x( 'Set featured image', 'page' ) ),
-               'remove_featured_image'    => array( _x( 'Remove featured image', 'post' ), _x( 'Remove featured image', 'page' ) ),
-               'use_featured_image'       => array( _x( 'Use as featured image', 'post' ), _x( 'Use as featured image', 'page' ) ),
-               'filter_items_list'        => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ),
-               'filter_by_date'           => array( __( 'Filter by date' ), __( 'Filter by date' ) ),
-               'items_list_navigation'    => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ),
-               'items_list'               => array( __( 'Posts list' ), __( 'Pages list' ) ),
-               'item_published'           => array( __( 'Post published.' ), __( 'Page published.' ) ),
-               'item_published_privately' => array( __( 'Post published privately.' ), __( 'Page published privately.' ) ),
-               'item_reverted_to_draft'   => array( __( 'Post reverted to draft.' ), __( 'Page reverted to draft.' ) ),
-               'item_scheduled'           => array( __( 'Post scheduled.' ), __( 'Page scheduled.' ) ),
-               'item_updated'             => array( __( 'Post updated.' ), __( 'Page updated.' ) ),
-               'item_link'                => array(
-                       _x( 'Post Link', 'navigation link block title' ),
-                       _x( 'Page Link', 'navigation link block title' ),
-               ),
-               'item_link_description'    => array(
-                       _x( 'A link to a post.', 'navigation link block description' ),
-                       _x( 'A link to a page.', 'navigation link block description' ),
-               ),
-       );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $nohier_vs_hier_defaults = WP_Post_Type::get_default_labels();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpincludestaxonomyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/taxonomy.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/taxonomy.php        2022-04-04 01:23:55 UTC (rev 53057)
+++ trunk/src/wp-includes/taxonomy.php  2022-04-04 03:48:08 UTC (rev 53058)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,6 +25,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function create_initial_taxonomies() {
</span><span class="cx" style="display: block; padding: 0 10px">        global $wp_rewrite;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        WP_Taxonomy::reset_default_labels();
+
</ins><span class="cx" style="display: block; padding: 0 10px">         if ( ! did_action( 'init' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $rewrite = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'category'    => false,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -659,49 +661,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $tax->labels['not_found'] = $tax->no_tagcloud;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $name_field_description   = __( 'The name is how it appears on your site.' );
-       $slug_field_description   = __( 'The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' );
-       $parent_field_description = __( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' );
-       $desc_field_description   = __( 'The description is not prominent by default; however, some themes may show it.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $nohier_vs_hier_defaults = WP_Taxonomy::get_default_labels();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $nohier_vs_hier_defaults = array(
-               'name'                       => array( _x( 'Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ),
-               'singular_name'              => array( _x( 'Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ),
-               'search_items'               => array( __( 'Search Tags' ), __( 'Search Categories' ) ),
-               'popular_items'              => array( __( 'Popular Tags' ), null ),
-               'all_items'                  => array( __( 'All Tags' ), __( 'All Categories' ) ),
-               'parent_item'                => array( null, __( 'Parent Category' ) ),
-               'parent_item_colon'          => array( null, __( 'Parent Category:' ) ),
-               'name_field_description'     => array( $name_field_description, $name_field_description ),
-               'slug_field_description'     => array( $slug_field_description, $slug_field_description ),
-               'parent_field_description'   => array( null, $parent_field_description ),
-               'desc_field_description'     => array( $desc_field_description, $desc_field_description ),
-               'edit_item'                  => array( __( 'Edit Tag' ), __( 'Edit Category' ) ),
-               'view_item'                  => array( __( 'View Tag' ), __( 'View Category' ) ),
-               'update_item'                => array( __( 'Update Tag' ), __( 'Update Category' ) ),
-               'add_new_item'               => array( __( 'Add New Tag' ), __( 'Add New Category' ) ),
-               'new_item_name'              => array( __( 'New Tag Name' ), __( 'New Category Name' ) ),
-               'separate_items_with_commas' => array( __( 'Separate tags with commas' ), null ),
-               'add_or_remove_items'        => array( __( 'Add or remove tags' ), null ),
-               'choose_from_most_used'      => array( __( 'Choose from the most used tags' ), null ),
-               'not_found'                  => array( __( 'No tags found.' ), __( 'No categories found.' ) ),
-               'no_terms'                   => array( __( 'No tags' ), __( 'No categories' ) ),
-               'filter_by_item'             => array( null, __( 'Filter by category' ) ),
-               'items_list_navigation'      => array( __( 'Tags list navigation' ), __( 'Categories list navigation' ) ),
-               'items_list'                 => array( __( 'Tags list' ), __( 'Categories list' ) ),
-               /* translators: Tab heading when selecting from the most used terms. */
-               'most_used'                  => array( _x( 'Most Used', 'tags' ), _x( 'Most Used', 'categories' ) ),
-               'back_to_items'              => array( __( '&larr; Go to Tags' ), __( '&larr; Go to Categories' ) ),
-               'item_link'                  => array(
-                       _x( 'Tag Link', 'navigation link block title' ),
-                       _x( 'Category Link', 'navigation link block title' ),
-               ),
-               'item_link_description'      => array(
-                       _x( 'A link to a tag.', 'navigation link block description' ),
-                       _x( 'A link to a category.', 'navigation link block description' ),
-               ),
-       );
-
</del><span class="cx" style="display: block; padding: 0 10px">         $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $labels = _get_custom_object_labels( $tax, $nohier_vs_hier_defaults );
</span></span></pre>
</div>
</div>

</body>
</html>