Make WordPress Core

Changeset 10767


Ignore:
Timestamp:
03/10/2009 11:02:29 PM (16 years ago)
Author:
ryan
Message:

gettext contexts. Props nbachiyski. see #9112

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r10754 r10767  
    791791                'future' => array(__('Scheduled'), __('Scheduled posts'), _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')),
    792792                'pending' => array(__('Pending Review'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')),
    793                 'draft' => array(__('Draft'), _c('Drafts|manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')),
     793                'draft' => array(__('Draft'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')),
    794794                'private' => array(__('Private'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')),
    795795            );
  • trunk/wp-admin/includes/schema.php

    r10766 r10767  
    364364
    365365    // Dummy gettext calls to get strings in the catalog.
    366     _c('Administrator|User role');
    367     _c('Editor|User role');
    368     _c('Author|User role');
    369     _c('Contributor|User role');
    370     _c('Subscriber|User role');
    371 
    372     add_role('administrator', 'Administrator|User role');
    373     add_role('editor', 'Editor|User role');
    374     add_role('author', 'Author|User role');
    375     add_role('contributor', 'Contributor|User role');
    376     add_role('subscriber', 'Subscriber|User role');
     366    /* translators: user role */
     367    _x('Administrator', 'User role');
     368    /* translators: user role */
     369    _x('Editor', 'User role');
     370    /* translators: user role */
     371    _x('Author', 'User role');
     372    /* translators: user role */
     373    _x('Contributor', 'User role');
     374    /* translators: user role */
     375    _x('Subscriber', 'User role');
     376
     377    add_role('administrator', 'Administrator');
     378    add_role('editor', 'Editor');
     379    add_role('author', 'Author');
     380    add_role('contributor', 'Contributor');
     381    add_role('subscriber', 'Subscriber');
    377382
    378383    // Add caps for Administrator role
  • trunk/wp-admin/includes/template.php

    r10716 r10767  
    764764    $posts_columns['media'] = _x('File', 'column name');
    765765    $posts_columns['author'] = __('Author');
    766     //$posts_columns['tags'] = _c('Tags|media column header');
     766    //$posts_columns['tags'] = _x('Tags', 'column name');
    767767    /* translators: column name */
    768768    $posts_columns['parent'] = _x('Attached to', 'column name');
     
    18931893        $edit = '<strong>' . $user_object->user_login . '</strong>';
    18941894    }
    1895     $role_name = isset($wp_roles->role_names[$role]) ? translate_with_context($wp_roles->role_names[$role]) : __('None');
     1895    $role_name = isset($wp_roles->role_names[$role]) ? translate_user_role($wp_roles->role_names[$role] ) : __('None');
    18961896    $r = "<tr id='user-$user_object->ID'$style>";
    18971897    $columns = get_column_headers('users');
     
    26802680
    26812681    foreach( $editable_roles as $role => $details ) {
    2682         $name = translate_with_context($details['name']);
     2682        $name = translate_user_role($details['name'] );
    26832683        if ( $selected == $role ) // Make default first in list
    26842684            $p = "\n\t<option selected='selected' value='$role'>$name</option>";
  • trunk/wp-admin/includes/upgrade.php

    r10736 r10767  
    9595    // Default category
    9696    $cat_name = __('Uncategorized');
    97     $cat_slug = sanitize_title(_c('Uncategorized|Default category slug'));
     97    /* translators: Default category slug */
     98    $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
    9899   
    99100    $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
     
    102103    // Default link category
    103104    $cat_name = __('Blogroll');
    104     $cat_slug = sanitize_title(_c('Blogroll|Default link category slug'));
     105    /* translators: Default link category slug */
     106    $cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug'));
    105107   
    106108    $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
     
    169171                                'post_title' => __('Hello world!'),
    170172                                'post_category' => 0,
    171                                 'post_name' => _c('hello-world|Default post slug'),
     173                                /* translators: Default post slug */
     174                                'post_name' => _x('hello-world', 'Default post slug'),
    172175                                'post_modified' => $now,
    173176                                'post_modified_gmt' => $now_gmt,
     
    200203                                'post_title' => __('About'),
    201204                                'post_category' => '',
    202                                 'post_name' => _c('about|Default page slug'),
     205                                /* translators: Default page slug */
     206                                'post_name' => _x('about', 'Default page slug'),
    203207                                'post_modified' => $now,
    204208                                'post_modified_gmt' => $now_gmt,
  • trunk/wp-admin/theme-editor.php

    r10734 r10767  
    174174<?php endwhile; ?>
    175175    </ul>
    176     <h4><?php echo _c('Styles|Theme stylesheets in theme editor'); ?></h4>
     176    <h4><?php /* translators: Theme stylesheets in theme editor */ echo _x('Styles', 'Theme stylesheets in theme editor'); ?></h4>
    177177    <ul>
    178178<?php
  • trunk/wp-admin/users.php

    r10694 r10767  
    277277    }
    278278
    279     $name = translate_with_context($name);
    280     $name = sprintf( _c('%1$s <span class="count">(%2$s)</span>|user role with count'), $name, $avail_roles[$this_role] );
     279    $name = translate_user_role( $name );
     280    /* translators: User role name with count */
     281    $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, $avail_roles[$this_role] );
    281282    $role_links[] = "<li><a href='users.php?role=$this_role'$class>$name</a>";
    282283}
  • trunk/wp-content/themes/classic/comments-popup.php

    r9835 r10767  
    5050    <li id="comment-<?php comment_ID() ?>">
    5151    <?php comment_text() ?>
    52     <p><cite><?php comment_type(_c('Comment|noun'), __('Trackback'), __('Pingback')); ?> <?php _e("by"); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
     52    <p><cite><?php comment_type(_x('Comment', 'noun'), __('Trackback'), __('Pingback')); ?> <?php _e("by"); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
    5353    </li>
    5454
  • trunk/wp-content/themes/classic/comments.php

    r9835 r10767  
    2222    <?php echo get_avatar( $comment, 32 ); ?>
    2323    <?php comment_text() ?>
    24     <p><cite><?php comment_type(_c('Comment|noun'), __('Trackback'), __('Pingback')); ?> <?php _e('by'); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
     24    <p><cite><?php comment_type(_x('Comment', 'noun'), __('Trackback'), __('Pingback')); ?> <?php _e('by'); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
    2525    </li>
    2626
  • trunk/wp-includes/comment.php

    r10762 r10767  
    253253    $status = array(
    254254        'hold'      => __('Unapproved'),
    255         'approve'   => _c('Approved|adjective'),
    256         'spam'      => _c('Spam|adjective'),
     255        /* translators: comment status  */
     256        'approve'   => _x('Approved', 'adjective'),
     257        /* translators: comment status */
     258        'spam'      => _x('Spam', 'adjective'),
    257259    );
    258260
  • trunk/wp-includes/formatting.php

    r10702 r10767  
    22152215    // Translate and filter the delimiter set (avoid ampersands and entities here)
    22162216    $l = apply_filters('wp_sprintf_l', array(
    2217         'between'          => _c(', |between list items'),
    2218         'between_last_two' => _c(', and |between last two list items'),
    2219         'between_only_two' => _c(' and |between only two list items'),
     2217        /* translators: used between list items, there is a space after the coma */
     2218        'between'          => __(', '),
     2219        /* translators: used between list items, there is a space after the and */
     2220        'between_last_two' => __(', and '),
     2221        /* translators: used between only two list items, there is a space after the and */
     2222        'between_only_two' => __(' and '),
    22202223        ));
    22212224
  • trunk/wp-includes/js/tinymce/langs/wp-langs.php

    r9917 r10767  
    180180
    181181tinyMCE.addI18n("' . $language . '.advanced",{
    182 style_select:"' . mce_escape( __('Styles') ) . '",
     182style_select:"' . mce_escape( /* translators: TinyMCE font styles */ _x('Styles', 'TinyMCE font styles') ) . '",
    183183font_size:"' . mce_escape( __('Font size') ) . '",
    184184fontdefault:"' . mce_escape( __('Font family') ) . '",
  • trunk/wp-includes/l10n.php

    r10584 r10767  
    177177    $translations = &get_translations_for_domain( $domain );
    178178    $translation = $translations->translate_plural( $single, $plural, $number );
    179     return apply_filters( 'ngettext', $translation, $single, $plural, $number );
     179    return apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );
    180180}
    181181
     
    192192    $translations = &get_translations_for_domain( $domain );
    193193    $translation = $translations->translate_plural( $single, $plural, $number, $context );
    194     return apply_filters( 'ngettext_with_context ', $translation, $single, $plural, $number, $context );
     194    return apply_filters( 'ngettext_with_context ', $translation, $single, $plural, $number, $context, $domain );
    195195}
    196196
     
    341341}
    342342
     343/**
     344 * Translates role name. Since the role names are in the database and
     345 * not in the source there are dummy gettext calls to get them into the POT
     346 * file and this function properly translates them back.
     347 *
     348 * The before_last_bar() call is needed, because older installs keep the roles
     349 * using the old context format: 'Role name|User role' and just skipping the
     350 * content after the last bar is easier than fixing them in the DB. New installs
     351 * won't suffer from that problem.
     352 */
     353function translate_user_role( $name ) {
     354    return before_last_bar( translate_with_gettext_context( $name, 'User role' ) );
     355}
    343356?>
Note: See TracChangeset for help on using the changeset viewer.