Add context to strings. Props nbachiyski. fixes #10738

git-svn-id: http://svn.automattic.com/wordpress/trunk@12231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-11-19 22:49:16 +00:00
parent 3de2e1a319
commit c831a9e3ef
9 changed files with 13 additions and 9 deletions

View File

@ -141,7 +141,7 @@ require_once('admin-header.php'); ?>
<div class="wrap"> <div class="wrap">
<?php screen_icon(); ?> <?php screen_icon(); ?>
<h2><?php echo esc_html( $title ); ?> <a href="page-new.php" class="button add-new-h2"><?php esc_html_e('Add New'); ?></a> <?php <h2><?php echo esc_html( $title ); ?> <a href="page-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'page'); ?></a> <?php
if ( isset($_GET['s']) && $_GET['s'] ) if ( isset($_GET['s']) && $_GET['s'] )
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?> printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
</h2> </h2>

View File

@ -134,7 +134,7 @@ else
<div class="wrap"> <div class="wrap">
<?php screen_icon(); ?> <?php screen_icon(); ?>
<h2><?php echo esc_html( $title ); ?> <a href="post-new.php" class="button add-new-h2"><?php esc_html_e('Add New'); ?></a> <?php <h2><?php echo esc_html( $title ); ?> <a href="post-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'post'); ?></a> <?php
if ( isset($_GET['s']) && $_GET['s'] ) if ( isset($_GET['s']) && $_GET['s'] )
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?> printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
</h2> </h2>

View File

@ -1657,7 +1657,7 @@ jQuery(function($){
<?php _e('Sort Order:'); ?> <?php _e('Sort Order:'); ?>
<a href="#" id="asc"><?php _e('Ascending'); ?></a> | <a href="#" id="asc"><?php _e('Ascending'); ?></a> |
<a href="#" id="desc"><?php _e('Descending'); ?></a> | <a href="#" id="desc"><?php _e('Descending'); ?></a> |
<a href="#" id="clear"><?php _e('Clear'); ?></a> <a href="#" id="clear"><?php echo _x('Clear', 'verb'); ?></a>
</div> </div>
<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form validate" id="gallery-form"> <form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
<?php wp_nonce_field('media-form'); ?> <?php wp_nonce_field('media-form'); ?>

View File

@ -70,7 +70,7 @@ $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
$menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top', 'menu-appearance', 'div' ); $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top', 'menu-appearance', 'div' );
$submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php'); $submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
$submenu['themes.php'][10] = array(__('Editor'), 'edit_themes', 'theme-editor.php'); $submenu['themes.php'][10] = array(__('Editor'), 'edit_themes', 'theme-editor.php');
$submenu['themes.php'][15] = array(__('Add New Themes'), 'install_themes', 'theme-install.php'); $submenu['themes.php'][15] = array(_x('Add New', 'theme'), 'install_themes', 'theme-install.php');
$update_plugins = get_transient( 'update_plugins' ); $update_plugins = get_transient( 'update_plugins' );
$update_count = 0; $update_count = 0;
@ -91,7 +91,7 @@ else
if ( current_user_can('edit_users') ) { if ( current_user_can('edit_users') ) {
$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php. $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
$submenu['users.php'][5] = array(__('Authors &amp; Users'), 'edit_users', 'users.php'); $submenu['users.php'][5] = array(__('Authors &amp; Users'), 'edit_users', 'users.php');
$submenu['users.php'][10] = array(__('Add New'), 'create_users', 'user-new.php'); $submenu['users.php'][10] = array(_x('Add New', 'user'), 'create_users', 'user-new.php');
$submenu['users.php'][15] = array(__('Your Profile'), 'read', 'profile.php'); $submenu['users.php'][15] = array(__('Your Profile'), 'read', 'profile.php');
} else { } else {
$_wp_real_parent_file['users.php'] = 'profile.php'; $_wp_real_parent_file['users.php'] = 'profile.php';

View File

@ -270,7 +270,7 @@ if ( !empty($invalid) )
<div class="wrap"> <div class="wrap">
<?php screen_icon(); ?> <?php screen_icon(); ?>
<h2><?php echo esc_html( $title ); ?> <a href="plugin-install.php" class="button add-new-h2"><?php esc_html_e('Add New'); ?></a></h2> <h2><?php echo esc_html( $title ); ?> <a href="plugin-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'plugin'); ?></a></h2>
<?php <?php

View File

@ -127,7 +127,7 @@ function theme_update_available( $theme ) {
<div class="wrap"> <div class="wrap">
<?php screen_icon(); ?> <?php screen_icon(); ?>
<h2><?php echo esc_html( $title ); ?> <a href="theme-install.php" class="button add-new-h2"><?php esc_html_e('Add New'); ?></a></h2> <h2><?php echo esc_html( $title ); ?> <a href="theme-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'theme'); ?></a></h2>
<h3><?php _e('Current Theme'); ?></h3> <h3><?php _e('Current Theme'); ?></h3>
<div id="current-theme"> <div id="current-theme">

View File

@ -170,7 +170,7 @@ do_action('restrict_manage_posts');
<div class="wrap"> <div class="wrap">
<?php screen_icon(); ?> <?php screen_icon(); ?>
<h2><?php echo esc_html( $title ); ?> <a href="media-new.php" class="button add-new-h2"><?php esc_html_e('Add New'); ?></a> <?php <h2><?php echo esc_html( $title ); ?> <a href="media-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a> <?php
if ( isset($_GET['s']) && $_GET['s'] ) if ( isset($_GET['s']) && $_GET['s'] )
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?> printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
</h2> </h2>

View File

@ -239,7 +239,7 @@ if ( ! empty($messages) ) {
<div class="wrap"> <div class="wrap">
<?php screen_icon(); ?> <?php screen_icon(); ?>
<h2><?php echo esc_html( $title ); ?> <a href="user-new.php" class="button add-new-h2"><?php esc_html_e('Add New'); ?></a> <?php <h2><?php echo esc_html( $title ); ?> <a href="user-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'user'); ?></a> <?php
if ( isset($_GET['usersearch']) && $_GET['usersearch'] ) if ( isset($_GET['usersearch']) && $_GET['usersearch'] )
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $_GET['usersearch'] ) ); ?> printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $_GET['usersearch'] ) ); ?>
</h2> </h2>

View File

@ -207,6 +207,10 @@ function esc_attr_x( $single, $context, $domain = 'default' ) {
return esc_attr( translate_with_gettext_context( $single, $context, $domain ) ); return esc_attr( translate_with_gettext_context( $single, $context, $domain ) );
} }
function esc_html_x( $single, $context, $domain = 'default' ) {
return esc_html( translate_with_gettext_context( $single, $context, $domain ) );
}
function __ngettext() { function __ngettext() {
_deprecated_function( __FUNCTION__, '2.8', '_n()' ); _deprecated_function( __FUNCTION__, '2.8', '_n()' );
$args = func_get_args(); $args = func_get_args();