Ticket #11838: 11838.crazy.translations.diff

File 11838.crazy.translations.diff, 12.8 KB (added by dd32, 3 years ago)
Line 
1Index: wp-admin/edit-tag-form.php
2===================================================================
3--- wp-admin/edit-tag-form.php  (revision 12942)
4+++ wp-admin/edit-tag-form.php  (working copy)
5@@ -10,11 +10,8 @@
6 if ( !defined('ABSPATH') )
7        die('-1');
8 
9-if ( !current_user_can('manage_categories') )
10-       wp_die(__('You do not have sufficient permissions to edit tags for this blog.'));
11-
12 if ( empty($tag_ID) ) { ?>
13-       <div id="message" class="updated"><p><strong><?php _e('A tag was not selected for editing.'); ?></strong></p></div>
14+       <div id="message" class="updated"><p><strong><?php printf( _x('A %s was not selected for editing.', '%s: singular taxonomy name'), $tax->singular_label); ?></strong></p></div>
15 <?php
16        return;
17 }
18@@ -23,11 +20,11 @@
19        do_action('edit_category_form_pre', $tag );
20 else
21        do_action('edit_tag_form_pre', $tag);
22-do_action('edit_' . $taxonomy . '_form_pre', $tag, $taxonomy);  ?>
23+do_action('edit_' . $taxonomy . '_form_pre', $tag, $taxonomy); ?>
24 
25 <div class="wrap">
26 <?php screen_icon(); ?>
27-<h2><?php _e('Edit Tag'); ?></h2>
28+<h2><?php printf(_x('Edit %s', '%s: singular taxonomy name'), $tax->singular_label); ?></h2>
29 <div id="ajax-response"></div>
30 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate">
31 <input type="hidden" name="action" value="editedtag" />
32@@ -36,27 +33,30 @@
33 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
34        <table class="form-table">
35                <tr class="form-field form-required">
36-                       <th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th>
37-                       <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /></td>
38+                       <th scope="row" valign="top"><label for="name"><?php echo _x('Name', 'Taxonomy Name'); ?></label></th>
39+                       <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
40+                       <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
41                </tr>
42 <?php if ( !is_multisite() ) { ?>
43                <tr class="form-field">
44-                       <th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
45+                       <th scope="row" valign="top"><label for="slug"><?php echo _x('Slug', 'Taxonomy Slug'); ?></label></th>
46                        <td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo esc_attr(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
47                        <p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
48                </tr>
49 <?php } ?>
50-<?php if ( is_taxonomy_hierarchical($taxonomy) ) { ?>
51+<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
52                <tr class="form-field">
53-                       <th scope="row" valign="top"><label for="parent"><?php _e('Category Parent') ?></label></th>
54+                       <th scope="row" valign="top"><label for="parent"><?php echo _x('Parent', 'Taxonomy Parent'); ?></label></th>
55                        <td>
56                                <?php wp_dropdown_categories(array('hide_empty' => 0, 'hide_if_empty' => false, 'name' => 'parent', 'orderby' => 'name', 'taxonomy' => $taxonomy, 'selected' => $tag->parent, 'exclude' => $tag->term_id, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
57+                               <?php if ( 'category' == $taxonomy ) : ?>
58                                <span class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></span>
59+                               <?php endif; ?>
60                        </td>
61                </tr>
62-<?php } ?>
63+<?php endif; // is_taxonomy_hierarchical() ?>
64                <tr class="form-field">
65-                       <th scope="row" valign="top"><label for="description"><?php _e('Description') ?></label></th>
66+                       <th scope="row" valign="top"><label for="description"><?php echo _x('Description', 'Taxonomy Description'); ?></label></th>
67                        <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($tag->description); ?></textarea><br />
68                        <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
69                </tr>
70@@ -68,8 +68,8 @@
71                do_action('edit_' . $taxonomy . '_form_fields', $tag, $taxonomy);
72                ?>
73        </table>
74-<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Tag'); ?>" /></p>
75-<?php
76+<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>
77+<?php
78 if ( 'category' == $taxonomy )
79        do_action('edit_category_form_', $tag);
80 else
81Index: wp-admin/edit-tags.php
82===================================================================
83--- wp-admin/edit-tags.php      (revision 12942)
84+++ wp-admin/edit-tags.php      (working copy)
85@@ -150,13 +150,15 @@
86 
87 require_once ('admin-header.php');
88 
89-$messages[1] = __('Tag added.');
90-$messages[2] = __('Tag deleted.');
91-$messages[3] = __('Tag updated.');
92-$messages[4] = __('Tag not added.');
93-$messages[5] = __('Tag not updated.');
94-$messages[6] = __('Tags deleted.'); ?>
95+$messages[1] = sprintf(_x('%s added.', '%s: singular taxonomy name'), $tax->singular_label);
96+$messages[2] = sprintf(_x('%s deleted.', '%s: singular taxonomy name'), $tax->singular_label);
97+$messages[3] = sprintf(_x('%s updated.', '%s: singular taxonomy name'), $tax->singular_label);
98+$messages[4] = sprintf(_x('%s not added.', '%s: singular taxonomy name'), $tax->singular_label);
99+$messages[5] = sprintf(_x('%s not updated.', '%s: singular taxonomy name'), $tax->singular_label);
100+$messages[6] = sprintf(_x('%s deleted.', '%s: plural taxonomy name'), $tax->label);
101 
102+?>
103+
104 <div class="wrap nosubsub">
105 <?php screen_icon(); ?>
106 <h2><?php echo esc_html( $title );
107@@ -174,9 +176,9 @@
108 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
109 <input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
110 <p class="search-box">
111-       <label class="screen-reader-text" for="tag-search-input"><?php _e( 'Search Tags' ); ?>:</label>
112+       <label class="screen-reader-text" for="tag-search-input"><?php printf(_x('Search %s', '%s: plural taxonomy name'), $tax->label); ?>:</label>
113        <input type="text" id="tag-search-input" name="s" value="<?php _admin_search_query(); ?>" />
114-       <input type="submit" value="<?php esc_attr_e( 'Search Tags' ); ?>" class="button" />
115+       <input type="submit" value="<?php echo esc_attr( sprintf(_x('Search %s', '%s: plural taxonomy name'), $tax->label) ); ?>" class="button" />
116 </p>
117 </form>
118 <br class="clear" />
119@@ -234,17 +236,17 @@
120 </div>
121 
122 <div class="clear"></div>
123-
124+<?php $table_type = 'category' == $taxonomy ? 'categories' : 'edit-tags'; ?>
125 <table class="widefat tag fixed" cellspacing="0">
126        <thead>
127        <tr>
128-<?php print_column_headers('edit-tags'); ?>
129+<?php print_column_headers($table_type); ?>
130        </tr>
131        </thead>
132 
133        <tfoot>
134        <tr>
135-<?php print_column_headers('edit-tags', false); ?>
136+<?php print_column_headers($table_type, false); ?>
137        </tr>
138        </tfoot>
139 
140@@ -272,6 +274,15 @@
141 
142 <br class="clear" />
143 </form>
144+
145+<?php if ( 'category' == $taxonomy ) : ?>
146+<div class="form-wrap">
147+<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), apply_filters('the_category', get_cat_name(get_option('default_category')))) ?></p>
148+<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'admin.php?import=wp-cat2tag') ?></p>
149+</div>
150+<?php endif; ?>
151+
152+
153 </div>
154 </div><!-- /col-right -->
155 
156@@ -279,7 +290,7 @@
157 <div class="col-wrap">
158 
159 <div class="tagcloud">
160-<h3><?php _e('Popular Tags'); ?></h3>
161+<h3><?php printf(_x('Popular %s', '%s: plural taxonomy name'), $tax->label); ?></h3>
162 <?php
163 if ( current_user_can($tax->edit_cap) )
164        wp_tag_cloud(array('taxonomy' => $taxonomy, 'link' => 'edit'));
165@@ -288,7 +299,8 @@
166 ?>
167 </div>
168 
169-<?php if ( current_user_can($tax->edit_cap) ) {
170+<?php
171+if ( current_user_can($tax->edit_cap) ) {
172        if ( 'category' == $taxonomy )
173                do_action('add_category_form_pre', (object)array('parent' => 0) );
174        else
175@@ -297,46 +309,46 @@
176 ?>
177 
178 <div class="form-wrap">
179-<h3><?php _e('Add a New Tag'); ?></h3>
180+<h3><?php printf(_x('Add a New %s', '%s: singular taxonomy name'), $tax->singular_label); ?></h3>
181 <form id="addtag" method="post" action="edit-tags.php" class="validate">
182 <input type="hidden" name="action" value="add-tag" />
183 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
184 <?php wp_nonce_field('add-tag'); ?>
185 
186 <div class="form-field form-required">
187-       <label for="tag-name"><?php _e('Tag name') ?></label>
188+       <label for="tag-name"><?php echo _x('Name', 'Taxonomy Name'); ?></label>
189        <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
190-       <p><?php _e('The name is how the tag appears on your site.'); ?></p>
191+       <p><?php _e('The name is how it appears on your site.'); ?></p>
192 </div>
193-<?php if ( !is_multisite() ) { ?>
194+<?php if ( !is_multisite() ) : ?>
195 <div class="form-field">
196-       <label for="slug"><?php _e('Tag slug') ?></label>
197+       <label for="slug"><?php echo _x('Slug', 'Taxonomy Slug'); ?></label>
198        <input name="slug" id="slug" type="text" value="" size="40" />
199        <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
200 </div>
201-<?php } ?>
202-<?php if ( is_taxonomy_hierarchical($taxonomy) ) { ?>
203+<?php endif; // is_multisite() ?>
204+<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
205 <div class="form-field">
206-       <label for="category_parent"><?php _e('Category Parent') ?></label>
207+       <label for="parent"><?php echo _x('Parent', 'Taxonomy Parent'); ?></label>
208        <?php wp_dropdown_categories(array('hide_empty' => 0, 'hide_if_empty' => false, 'taxonomy' => $taxonomy, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => true, 'show_option_none' => __('None'))); ?>
209-       <p><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p>
210+       <?php if ( 'category' == $taxonomy ) : ?>
211+               <p><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p>
212+       <?php endif; ?>
213 </div>
214-<?php } ?>
215+<?php endif; // is_taxonomy_hierarchical() ?>
216 <div class="form-field">
217-       <label for="description"><?php _e('Description') ?></label>
218+       <label for="description"><?php echo _x('Description', 'Taxonomy Description'); ?></label>
219        <textarea name="description" id="description" rows="5" cols="40"></textarea>
220        <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p>
221 </div>
222-
223-<?php
224+<?php
225 if ( 'category' == $taxonomy )
226        do_action('add_category_form_fields');
227 else
228        do_action('add_tag_form_fields', $taxonomy);
229 do_action('add_' . $taxonomy . '_form_fields', $taxonomy);
230 ?>
231-
232-<p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php esc_attr_e('Add Tag'); ?>" /></p>
233+<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>
234 <?php
235 if ( 'category' == $taxonomy )
236        do_action('edit_category_form', (object)array('parent' => 0) );
237@@ -361,4 +373,4 @@
238 
239 include('admin-footer.php');
240 
241-?>
242+?>
243\ No newline at end of file
244Index: wp-includes/taxonomy.php
245===================================================================
246--- wp-includes/taxonomy.php    (revision 12942)
247+++ wp-includes/taxonomy.php    (working copy)
248@@ -18,6 +18,7 @@
249        register_taxonomy( 'category', 'post', array(   'hierarchical' => true,
250                                                                                                        'update_count_callback' => '_update_post_term_count',
251                                                                                                        'label' => __('Categories'),
252+                                                                                                       'singular_label' => __('Category'),
253                                                                                                        'query_var' => false,
254                                                                                                        'rewrite' => false
255                                                                                                ) ) ;
256@@ -26,6 +27,7 @@
257                                                                                                        'hierarchical' => false,
258                                                                                                        'update_count_callback' => '_update_post_term_count',
259                                                                                                        'label' => __('Post Tags'),
260+                                                                                                       'singular_label' => __('Post Tag'), //For the record, I'd prefer this to be changed to "Tags" and "Tag"
261                                                                                                        'query_var' => false,
262                                                                                                        'rewrite' => false
263                                                                                                ) ) ;
264@@ -212,6 +214,9 @@
265                if ( empty($args[$cap]) )
266                        $args[$cap] = 'manage_categories';
267        }
268+       
269+       if ( empty($args['singular_label']) )
270+               $args['singular_label'] = $args['label'];
271 
272        $args['name'] = $taxonomy;
273        $args['object_type'] = (array) $object_type;