i18n fixes, logic cleanup, wording clarifications, and more from nbachiyski. fixes #3474

git-svn-id: http://svn.automattic.com/wordpress/trunk@4658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2006-12-21 23:06:18 +00:00
parent bdd210972c
commit 8a678f3841
17 changed files with 62 additions and 70 deletions

View File

@ -40,10 +40,10 @@ function wp_write_post() {
if ( $_POST['post_author'] != $_POST['user_ID'] ) {
if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_others_pages' ) )
return new WP_Error( 'edit_others_pages', __( 'You cannot create pages as this user.' ) );
return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
} else {
if ( !current_user_can( 'edit_others_posts' ) )
return new WP_Error( 'edit_others_posts', __( 'You cannot post as this user.' ) );
return new WP_Error( 'edit_others_posts', __( 'You are not allowed to post as this user.' ) );
}
}
@ -184,10 +184,10 @@ function edit_post() {
if ( $_POST['post_author'] != $_POST['user_ID'] ) {
if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_others_pages' ) )
wp_die( __('You cannot edit pages as this user.' ));
wp_die( __('You are not allowed to edit pages as this user.' ));
} else {
if ( !current_user_can( 'edit_others_posts' ) )
wp_die( __('You cannot edit posts as this user.' ));
wp_die( __('You are not allowed to edit posts as this user.' ));
}
}
@ -561,7 +561,7 @@ function add_link() {
function edit_link( $link_id = '' ) {
if (!current_user_can( 'manage_links' ))
wp_die( __("Cheatin' uh ?" ));
wp_die( __( 'Cheatin&8217; uh?' ));
$_POST['link_url'] = wp_specialchars( $_POST['link_url'] );
$_POST['link_url'] = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $_POST['link_url']) ? $_POST['link_url'] : 'http://' . $_POST['link_url'];
@ -826,7 +826,7 @@ function user_row( $user_object, $style = '' ) {
$r .= "\n\t\t<td align='center'>";
if ( $numposts > 0 ) {
$r .= "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "' class='edit'>";
$r .= sprintf( __('View %1$s %2$s' ), $numposts, __ngettext( 'post', 'posts', $numposts ));
$r .= sprintf(__ngettext( 'View %s post', 'View %s posts', $numposts ), $numposts);
$r .= '</a>';
}
$r .= "</td>\n\t\t<td>";
@ -1069,9 +1069,7 @@ function touch_time( $edit = 1, $for_post = 1 ) {
<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
<?php
if ( $edit ) {
_e( 'Existing timestamp' );
//echo ': ' . $wp_locale->get_month( $mm ) . "$jj, $aa @ $hh:$mn";
echo sprintf( __(': %1$s %2$s, %3$s @ %4$s:%5$s' ), $wp_locale->get_month( $mm ), $jj, $aa, $hh, $mn );
printf( __('Existing timestamp: %1$s %2$s, %3$s @ %4$s:%5$s' ), $wp_locale->get_month( $mm ), $jj, $aa, $hh, $mn );
}
?>
</fieldset>

View File

@ -34,10 +34,10 @@ case 'delete':
// Don't delete the default cats.
if ( $cat_ID == get_option('default_category') )
wp_die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
wp_die(sprintf(__("Can&8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
if ( $cat_ID == get_option('default_link_category') )
wp_die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one for links"), $cat_name));
wp_die(sprintf(__("Can&8217;t delete the <strong>%s</strong> category: this is the default one for links"), $cat_name));
wp_delete_category($cat_ID);

View File

@ -67,10 +67,11 @@ if ( !empty( $_POST['delete_comments'] ) ) :
}
endforeach;
echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>';
if ( !empty( $_POST['spam_button'] ) )
printf(__('%s comments marked as spam.'), $i);
else
printf(__('%s comments deleted.'), $i);
if ( !empty( $_POST['spam_button'] ) ) {
printf(__ngettext('%s comment marked as spam', '%s comments marked as spam.', $i), $i);
} else {
printf(__ngettext('%s comment deleted.', '%s comments deleted.', $i), $i);
}
echo '</p></div>';
endif;

View File

@ -206,7 +206,7 @@ if (current_user_can('upload_files')) {
<h3 class="dbx-handle"><?php _e('Trackbacks') ?></h3>
</div>
<div class="dbx-c-ontent-wrapper">
<div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>)
<div class="dbx-content"><?php _e('Send trackbacks to:'); ?> <?php echo $form_trackback; ?> (<?php _e('Separate multiple URLs with spaces'); ?>)
<?php
if ( ! empty($pings) )
echo $pings;

View File

@ -67,7 +67,7 @@ addLoadEvent(focusit);
<tr>
<th scope="row" valign="top"><?php _e('Delete'); $delete_nonce = wp_create_nonce( 'delete-comment_' . $comment->comment_ID ); ?>:</th>
<td><input name="deletecomment" class="button delete" type="submit" id="deletecomment" tabindex="10" value="<?php _e('Delete this comment') ?>" <?php echo "onclick=\"if ( confirm('" . __("You are about to delete this comment \\n \'Cancel\' to stop, \'OK\' to delete.") . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true; } return false;\""; ?> />
<td><input name="deletecomment" class="button delete" type="submit" id="deletecomment" tabindex="10" value="<?php _e('Delete this comment') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true; } return false;\""; ?> />
<input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" />
<input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" />
<input type="hidden" name="noredir" value="1" />

View File

@ -51,7 +51,7 @@ edCanvas = document.getElementById('content');
<input type="hidden" name="post_pingback" value="<?php echo get_option('default_pingback_flag') ?>" id="post_pingback" />
<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?>
<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)'), 'http://wordpress.org/docs/reference/post/#trackback'); echo '<br />'; ?>
<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />

View File

@ -82,7 +82,7 @@ addLoadEvent(focusit);
<?php if ( 0 != count( get_page_templates() ) ) { ?>
<fieldset id="pagetemplate" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Page Template:') ?></h3>
<h3 class="dbx-handle"><?php _e('Page Template') ?></h3>
<div class="dbx-content"><p><select name="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown($post->page_template); ?>

View File

@ -221,7 +221,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
case 'control_delete':
?>
<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title()) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td>
<?php
break;
@ -283,12 +283,12 @@ foreach ($comments as $comment) {
<?php
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $post->ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $post->ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $post->ID . '&amp;c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $post->ID . '&amp;c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
}
echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=".$comment->comment_post_ID."&amp;c=".$comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), js_escape( $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ]";
echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=".$comment->comment_post_ID."&amp;c=".$comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), js_escape( $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ]";
} // end if any comments to show
?>
</p>

View File

@ -14,7 +14,7 @@ require_once ('admin-header.php');
<div class="narrow">
<p><?php _e('When you click the button below WordPress will create an XML file for you to save to your computer.'); ?></p>
<p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, comments, custom fields, and categories.'); ?></p>
<p><?php _e('Once you\'ve saved the download file, you can use the Import function on another WordPress blog to import this blog.'); ?></p>
<p><?php _e('Once you&8217;ve saved the download file, you can use the Import function on another WordPress blog to import this blog.'); ?></p>
<form action="" method="get">
<h3><?php _e('Optional options'); ?></h3>

View File

@ -107,7 +107,12 @@ if (0 < $numcomms) $numcomms = number_format($numcomms);
$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
if (0 < $numcats) $numcats = number_format($numcats);
?>
<p><?php printf(__('There are currently %1$s <a href="%2$s" title="Posts">posts</a> and %3$s <a href="%4$s" title="Comments">comments</a>, contained within %5$s <a href="%6$s" title="categories">categories</a>.'), $numposts, 'edit.php', $numcomms, 'edit-comments.php', $numcats, 'categories.php'); ?></p>
<p><?php
$post_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Posts">post</a>', '%1$s <a href="%2$s" title="Posts">posts</a>', $numposts), $numposts, 'edit.php');
$comm_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Comments">comment</a>', '%1$s <a href="%2$s" title="Comments">comments</a>', $numcomms), $numcomms, 'edit-comments.php');
$cat_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Categories">category</a>', '%1$s <a href="%2$s" title="Categories">categories</a>', $numcats), $numcats, 'categories.php');
printf(__('There are currently %1$s and %2$s, contained within %3$s.'), $post_str, $comm_str, $cat_str); ?></p>
</div>
<?php do_action('activity_box_end'); ?>

View File

@ -28,7 +28,7 @@ require('admin-header.php');
<div id="wp-link-bookmarklet" class="wrap">
<h3><?php _e('Add Link Bookmarklet'); ?></h3>
<p><?php _e('Right click on the following link and choose "Bookmark This Link..." to create an add link shortcut. Right now this only works on Mozilla or Netscape, but were working on it.'); ?></p>
<p><?php _e('Right click on the following link and choose "Bookmark This Link..." to create an add link shortcut. Right now this only works on Mozilla or Netscape, but we&8217;re working on it.'); ?></p>
<?php printf('<p><a href="%s" title="'.__('Link add bookmarklet').'">'.__('Link This').'</a></p>', "javascript:void(linkmanpopup=window.open('" . get_option('siteurl') . "/wp-admin/link-add.php?action=popup&amp;linkurl='+escape(location.href)+'&amp;name='+escape(document.title),'LinkManager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();") ?>
</div>

View File

@ -65,7 +65,7 @@ function checkAll(form)
if ( isset($_GET['deleted']) ) {
echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>';
$deleted = (int) $_GET['deleted'];
printf(__('%s links deleted.'), $deleted);
printf(__ngettext('%s link deleted.', '%s links deleted', $deleted), $deleted);
echo '</p></div>';
}
?>

View File

@ -72,32 +72,20 @@ if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored
$ignored = (int) $_GET['ignored'];
$spam = (int) $_GET['spam'];
if ($approved) {
if ('1' == $approved) {
echo __("1 comment approved") . " <br/>\n";
} else {
echo sprintf(__("%s comments approved <br />"), $approved) . "\n";
}
printf(__ngettext('%s comment approved', '%s comments approved', $approved), $approved);
echo "<br/>\n";
}
if ($deleted) {
if ('1' == $deleted) {
echo __("1 comment deleted") . " <br/>\n";
} else {
echo sprintf(__("%s comments deleted"), $deleted) . " <br/>\n";
}
printf(__ngettext('%s comment deleted', '%s comments deleted', $deleted), $deleted);
echo "<br/>\n";
}
if ($spam) {
if ('1' == $spam) {
echo __("1 comment marked as spam") . " <br/>\n";
} else {
echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
}
printf(__ngettext('%s comment marked as spam', '%s comments marked as spam', $spam), $spam);
echo "<br/>\n";
}
if ($ignored) {
if ('1' == $ignored) {
echo __("1 comment unchanged") . " <br/>\n";
} else {
echo sprintf(__("%s comments unchanged"), $ignored) . " <br/>\n";
}
printf(__ngettext('%s comment unchanged', '%s comments unchanged', $ignored), $ignored);
echo "<br/>\n";
}
echo "</p></div>\n";
}

View File

@ -13,7 +13,7 @@ include('admin-header.php');
<?php wp_nonce_field('update-options') ?>
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
<fieldset class="options">
<legend><?php _e('Usual settings for an article:<br /><small><em>(These settings may be overridden for individual articles.)</em></small>') ?></legend>
<legend><?php echo __('Usual settings for an article:').'<br /><small><em>('.__('These settings may be overridden for individual articles.').')</em></small>'; ?></legend>
<ul>
<li>
<label for="default_pingback_flag">

View File

@ -79,7 +79,7 @@ $plugins = get_plugins();
if (empty($plugins)) {
echo '<p>';
_e("Couldn't open plugins directory or there are no plugins available."); // TODO: make more helpful
_e("Couldn&8217;t open plugins directory or there are no plugins available."); // TODO: make more helpful
echo '</p>';
} else {
?>

View File

@ -290,7 +290,7 @@ default:
case 'del_many':
?>
<?php $delete_count = (int) $_GET['delete_count']; ?>
<div id="message" class="updated fade"><p><?php printf(__('%1$s %2$s deleted.'), $delete_count, __ngettext('user', 'users', $delete_count) ); ?></p></div>
<div id="message" class="updated fade"><p><?php printf(__ngettext('%s user deleted', '%s users deleted', $delete_count), $delete_count); ?></p></div>
<?php
break;
case 'add':

View File

@ -738,22 +738,22 @@ function human_time_diff( $from, $to = '' ) {
$diff = (int) abs($to - $from);
if ($diff <= 3600) {
$mins = round($diff / 60);
if ($mins <= 1)
$since = __('1 min');
else
$since = sprintf( __('%s mins'), $mins);
if ($mins <= 1) {
$mins = 1;
}
$since = sprintf(__ngettext('%s min', '%s mins', $mins), $mins);
} else if (($diff <= 86400) && ($diff > 3600)) {
$hours = round($diff / 3600);
if ($hours <= 1)
$since = __('1 hour');
else
$since = sprintf( __('%s hours'), $hours );
if ($hours <= 1) {
$hour = 1;
}
$since = sprintf(__ngettext('%s hour', '%s hours', $hours), $hours);
} elseif ($diff >= 86400) {
$days = round($diff / 86400);
if ($days <= 1)
$since = __('1 day');
else
$since = sprintf( __('%s days'), $days );
if ($days <= 1) {
$days = 1;
}
$since = sprintf(__('%s day', '%s days', $days), $days);
}
return $since;
}