WordPress.org

Make WordPress Core

Changeset 14647


Ignore:
Timestamp:
05/14/2010 09:46:25 PM (8 years ago)
Author:
nacin
Message:

Introduce _ex(), a hybrid between _e() and _x() -- translate with context, then echo. props westi, see #13395.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/comment.php

    r14139 r14647  
    160160<?php } ?>
    161161<tr>
    162 <th scope="row" valign="top"><?php /* translators: field name in comment form */ echo _x('Comment', 'noun'); ?></th>
     162<th scope="row" valign="top"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th>
    163163<td><?php echo $comment->comment_content; ?></td>
    164164</tr>
  • trunk/wp-admin/edit-comments.php

    r14512 r14647  
    317317<?php endif; ?>
    318318<?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?>
    319 <option value="spam"><?php echo _x('Mark as Spam', 'comment'); ?></option>
     319<option value="spam"><?php _ex('Mark as Spam', 'comment'); ?></option>
    320320<?php endif; ?>
    321321<?php if ( 'trash' == $comment_status ): ?>
    322322<option value="untrash"><?php _e('Restore'); ?></option>
    323323<?php elseif ( 'spam' == $comment_status ): ?>
    324 <option value="unspam"><?php echo _x('Not Spam', 'comment'); ?></option>
     324<option value="unspam"><?php _ex('Not Spam', 'comment'); ?></option>
    325325<?php endif; ?>
    326326<?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?>
     
    417417<?php endif; ?>
    418418<?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?>
    419 <option value="spam"><?php echo _x('Mark as Spam', 'comment'); ?></option>
     419<option value="spam"><?php _ex('Mark as Spam', 'comment'); ?></option>
    420420<?php endif; ?>
    421421<?php if ( 'trash' == $comment_status ): ?>
     
    425425<option value="delete"><?php _e('Delete Permanently'); ?></option>
    426426<?php elseif ( 'spam' == $comment_status ): ?>
    427 <option value="unspam"><?php echo _x('Not Spam', 'comment'); ?></option>
     427<option value="unspam"><?php _ex('Not Spam', 'comment'); ?></option>
    428428<?php else: ?>
    429429<option value="trash"><?php _e('Move to Trash'); ?></option>
  • trunk/wp-admin/edit-form-comment.php

    r14044 r14647  
    4848
    4949<div class="misc-pub-section" id="comment-status-radio">
    50 <label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php /* translators: comment type radio button */ echo _x('Approved', 'adjective') ?></label><br />
    51 <label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php /* translators: comment type radio button */ echo _x('Pending', 'adjective') ?></label><br />
    52 <label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php /* translators: comment type radio button */ echo _x('Spam', 'adjective'); ?></label>
     50<label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php /* translators: comment type radio button */ _ex('Approved', 'adjective') ?></label><br />
     51<label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php /* translators: comment type radio button */ _ex('Pending', 'adjective') ?></label><br />
     52<label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php /* translators: comment type radio button */ _ex('Spam', 'adjective'); ?></label>
    5353</div>
    5454
  • trunk/wp-admin/edit-tag-form.php

    r14614 r14647  
    3434    <table class="form-table">
    3535        <tr class="form-field form-required">
    36             <th scope="row" valign="top"><label for="name"><?php echo _x('Name', 'Taxonomy Name'); ?></label></th>
     36            <th scope="row" valign="top"><label for="name"><?php _ex('Name', 'Taxonomy Name'); ?></label></th>
    3737            <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
    3838            <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
     
    4040<?php if ( !global_terms_enabled() ) { ?>
    4141        <tr class="form-field">
    42             <th scope="row" valign="top"><label for="slug"><?php echo _x('Slug', 'Taxonomy Slug'); ?></label></th>
     42            <th scope="row" valign="top"><label for="slug"><?php _ex('Slug', 'Taxonomy Slug'); ?></label></th>
    4343            <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" />
    4444            <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>
     
    4747<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
    4848        <tr class="form-field">
    49             <th scope="row" valign="top"><label for="parent"><?php echo _x('Parent', 'Taxonomy Parent'); ?></label></th>
     49            <th scope="row" valign="top"><label for="parent"><?php _ex('Parent', 'Taxonomy Parent'); ?></label></th>
    5050            <td>
    5151                <?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 />
     
    5757<?php endif; // is_taxonomy_hierarchical() ?>
    5858        <tr class="form-field">
    59             <th scope="row" valign="top"><label for="description"><?php echo _x('Description', 'Taxonomy Description'); ?></label></th>
     59            <th scope="row" valign="top"><label for="description"><?php _ex('Description', 'Taxonomy Description'); ?></label></th>
    6060            <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($tag->description); ?></textarea><br />
    6161            <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
  • trunk/wp-admin/edit-tags.php

    r14614 r14647  
    349349
    350350<div class="form-field form-required">
    351     <label for="tag-name"><?php echo _x('Name', 'Taxonomy Name'); ?></label>
     351    <label for="tag-name"><?php _ex('Name', 'Taxonomy Name'); ?></label>
    352352    <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
    353353    <p><?php _e('The name is how it appears on your site.'); ?></p>
     
    355355<?php if ( ! global_terms_enabled() ) : ?>
    356356<div class="form-field">
    357     <label for="tag-slug"><?php echo _x('Slug', 'Taxonomy Slug'); ?></label>
     357    <label for="tag-slug"><?php _ex('Slug', 'Taxonomy Slug'); ?></label>
    358358    <input name="slug" id="tag-slug" type="text" value="" size="40" />
    359359    <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>
     
    362362<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
    363363<div class="form-field">
    364     <label for="parent"><?php echo _x('Parent', 'Taxonomy Parent'); ?></label>
     364    <label for="parent"><?php _ex('Parent', 'Taxonomy Parent'); ?></label>
    365365    <?php wp_dropdown_categories(array('hide_empty' => 0, 'hide_if_empty' => false, 'taxonomy' => $taxonomy, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => true, 'show_option_none' => __('None'))); ?>
    366366    <?php if ( 'category' == $taxonomy ) : // @todo: Generic text for hierarchical taxonomies ?>
     
    370370<?php endif; // is_taxonomy_hierarchical() ?>
    371371<div class="form-field">
    372     <label for="tag-description"><?php echo _x('Description', 'Taxonomy Description'); ?></label>
     372    <label for="tag-description"><?php _ex('Description', 'Taxonomy Description'); ?></label>
    373373    <textarea name="description" id="tag-description" rows="5" cols="40"></textarea>
    374374    <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p>
  • trunk/wp-admin/includes/media.php

    r14633 r14647  
    17201720<a href="#" id="asc"><?php _e('Ascending'); ?></a> |
    17211721<a href="#" id="desc"><?php _e('Descending'); ?></a> |
    1722 <a href="#" id="clear"><?php echo _x('Clear', 'verb'); ?></a>
     1722<a href="#" id="clear"><?php _ex('Clear', 'verb'); ?></a>
    17231723</div>
    17241724<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
  • trunk/wp-admin/includes/plugin-install.php

    r14374 r14647  
    170170            <option value="term"<?php selected('term', $type) ?>><?php _e('Term'); ?></option>
    171171            <option value="author"<?php selected('author', $type) ?>><?php _e('Author'); ?></option>
    172             <option value="tag"<?php selected('tag', $type) ?>><?php echo _x('Tag', 'Plugin Installer'); ?></option>
     172            <option value="tag"<?php selected('tag', $type) ?>><?php _ex('Tag', 'Plugin Installer'); ?></option>
    173173        </select>
    174174        <input type="text" name="s" value="<?php echo esc_attr($term) ?>" />
  • trunk/wp-admin/includes/template.php

    r14637 r14647  
    36033603    <form id="adv-settings" action="" method="post">
    36043604    <?php if ( isset($wp_meta_boxes[$screen->id]) ) : ?>
    3605         <h5><?php echo _x('Show on screen', 'Metaboxes') ?></h5>
     3605        <h5><?php _ex('Show on screen', 'Metaboxes') ?></h5>
    36063606        <div class="metabox-prefs">
    36073607            <?php meta_box_prefs($screen); ?>
  • trunk/wp-admin/includes/theme-install.php

    r13763 r14647  
    157157    <option value="term" <?php selected('term', $type) ?>><?php _e('Term'); ?></option>
    158158    <option value="author" <?php selected('author', $type) ?>><?php _e('Author'); ?></option>
    159     <option value="tag" <?php selected('tag', $type) ?>><?php echo _x('Tag', 'Theme Installer'); ?></option>
     159    <option value="tag" <?php selected('tag', $type) ?>><?php _ex('Tag', 'Theme Installer'); ?></option>
    160160    </select>
    161161    <input type="text" name="s" size="30" value="<?php echo esc_attr($term) ?>" />
  • trunk/wp-admin/ms-sites.php

    r14632 r14647  
    114114                        </tr>
    115115                        <tr class="form-field">
    116                             <th scope="row"><?php echo _x( 'Registered', 'site' ) ?></th>
     116                            <th scope="row"><?php _ex( 'Registered', 'site' ) ?></th>
    117117                            <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" size="40" /></td>
    118118                        </tr>
     
    415415                <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option>
    416416                <option value="delete"><?php _e( 'Delete' ); ?></option>
    417                 <option value="spam"><?php echo _x( 'Mark as Spam', 'site' ); ?></option>
    418                 <option value="notspam"><?php echo _x( 'Not Spam', 'site' ); ?></option>
     417                <option value="spam"><?php _ex( 'Mark as Spam', 'site' ); ?></option>
     418                <option value="notspam"><?php _ex( 'Not Spam', 'site' ); ?></option>
    419419            </select>
    420420            <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" />
     
    666666                <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option>
    667667                <option value="delete"><?php _e( 'Delete' ); ?></option>
    668                 <option value="spam"><?php echo _x( 'Mark as Spam', 'site' ); ?></option>
    669                 <option value="notspam"><?php echo _x( 'Not Spam', 'site' ); ?></option>
     668                <option value="spam"><?php _ex( 'Mark as Spam', 'site' ); ?></option>
     669                <option value="notspam"><?php _ex( 'Not Spam', 'site' ); ?></option>
    670670            </select>
    671671            <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
  • trunk/wp-admin/ms-users.php

    r14632 r14647  
    131131                    <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option>
    132132                    <option value="delete"><?php _e( 'Delete' ); ?></option>
    133                     <option value="spam"><?php echo _x( 'Mark as Spam', 'user' ); ?></option>
    134                     <option value="notspam"><?php echo _x( 'Not Spam', 'user' ); ?></option>
     133                    <option value="spam"><?php _ex( 'Mark as Spam', 'user' ); ?></option>
     134                    <option value="notspam"><?php _ex( 'Not Spam', 'user' ); ?></option>
    135135                </select>
    136136                <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" />
     
    325325                    <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option>
    326326                    <option value="delete"><?php _e( 'Delete' ); ?></option>
    327                     <option value="spam"><?php echo _x( 'Mark as Spam', 'user' ); ?></option>
    328                     <option value="notspam"><?php echo _x( 'Not Spam', 'user' ); ?></option>
     327                    <option value="spam"><?php _ex( 'Mark as Spam', 'user' ); ?></option>
     328                    <option value="notspam"><?php _ex( 'Not Spam', 'user' ); ?></option>
    329329                </select>
    330330                <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
  • trunk/wp-admin/theme-editor.php

    r14625 r14647  
    173173<?php endwhile; ?>
    174174    </ul>
    175     <h3><?php /* translators: Theme stylesheets in theme editor */ echo _x('Styles', 'Theme stylesheets in theme editor'); ?></h3>
     175    <h3><?php /* translators: Theme stylesheets in theme editor */ _ex('Styles', 'Theme stylesheets in theme editor'); ?></h3>
    176176    <ul>
    177177<?php
  • trunk/wp-admin/upload.php

    r14548 r14647  
    364364    <th scope="col" class="check-column"><input type="checkbox" /></th>
    365365    <th scope="col"></th>
    366     <th scope="col"><?php /* translators: column name in media */ echo _x('Media', 'media column name'); ?></th>
    367     <th scope="col"><?php /* translators: column name in media */ echo _x('Author', 'media column name'); ?></th>
    368     <th scope="col"><?php /* translators: column name in media */ echo _x('Date Added', 'media column name'); ?></th>
     366    <th scope="col"><?php /* translators: column name in media */ _ex('Media', 'media column name'); ?></th>
     367    <th scope="col"><?php /* translators: column name in media */ _ex('Author', 'media column name'); ?></th>
     368    <th scope="col"><?php /* translators: column name in media */ _ex('Date Added', 'media column name'); ?></th>
    369369</tr>
    370370</thead>
     
    374374    <th scope="col" class="check-column"><input type="checkbox" /></th>
    375375    <th scope="col"></th>
    376     <th scope="col"><?php /* translators: column name in media */ echo _x('Media', 'media column name'); ?></th>
    377     <th scope="col"><?php /* translators: column name in media */ echo _x('Author', 'media column name'); ?></th>
    378     <th scope="col"><?php /* translators: column name in media */ echo _x('Date Added', 'media column name'); ?></th>
     376    <th scope="col"><?php /* translators: column name in media */ _ex('Media', 'media column name'); ?></th>
     377    <th scope="col"><?php /* translators: column name in media */ _ex('Author', 'media column name'); ?></th>
     378    <th scope="col"><?php /* translators: column name in media */ _ex('Date Added', 'media column name'); ?></th>
    379379</tr>
    380380</tfoot>
  • trunk/wp-includes/l10n.php

    r14456 r14647  
    189189function _x( $single, $context, $domain = 'default' ) {
    190190    return translate_with_gettext_context( $single, $context, $domain );
     191}
     192
     193/**
     194 * Displays translated string with gettext context
     195 *
     196 * @see _x
     197 * @since 3.0.0
     198 *
     199 * @param string $text Text to translate
     200 * @param string $context Context information for the translators
     201 * @param string $domain Optional. Domain to retrieve the translated text
     202 * @return string Translated context string without pipe
     203 */
     204function _ex( $single, $context, $domain = 'default' ) {
     205    echo _x( $single, $context, $domain );
    191206}
    192207
Note: See TracChangeset for help on using the changeset viewer.