Changeset 6916
- Timestamp:
- 02/19/2008 08:28:54 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
wp-admin/includes/schema.php (modified) (1 diff)
-
wp-admin/includes/template.php (modified) (3 diffs)
-
wp-admin/users.php (modified) (1 diff)
-
wp-includes/l10n.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/schema.php
r6896 r6916 268 268 function populate_roles_160() { 269 269 // Add roles 270 add_role('administrator', _c('Administrator|User role')); 271 add_role('editor', _c('Editor|User role')); 272 add_role('author', _c('Author|User role')); 273 add_role('contributor', _c('Contributor|User role')); 274 add_role('subscriber', _c('Subscriber|User role')); 270 271 // Dummy gettext calls to get strings in the catalog. 272 _c('Administrator|User role'); 273 _c('Editor|User role'); 274 _c('Author|User role'); 275 _c('Contributor|User role'); 276 _c('Subscriber|User role'); 277 278 add_role('administrator', 'Administrator|User role'); 279 add_role('editor', 'Editor|User role'); 280 add_role('author', 'Author|User role'); 281 add_role('contributor', 'Contributor|User role'); 282 add_role('subscriber', 'Subscriber|User role'); 275 283 276 284 // Add caps for Administrator role -
trunk/wp-admin/includes/template.php
r6910 r6916 546 546 $edit = $user_object->user_login; 547 547 } 548 $role_name = translate_with_context($wp_roles->role_names[$role]); 548 549 $r = "<tr id='user-$user_object->ID'$style> 549 550 <td><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></td> … … 551 552 <td>$user_object->first_name $user_object->last_name</td> 552 553 <td><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td> 553 <td> {$wp_roles->role_names[$role]}</td>";554 <td>$role_name</td>"; 554 555 $r .= "\n\t\t<td>"; 555 556 if ( $numposts > 0 ) { … … 892 893 global $wp_roles; 893 894 $r = ''; 894 foreach( $wp_roles->role_names as $role => $name ) 895 foreach( $wp_roles->role_names as $role => $name ) { 896 $name = translate_with_context($name); 895 897 if ( $default == $role ) // Make default first in list 896 898 $p = "\n\t<option selected='selected' value='$role'>$name</option>"; 897 899 else 898 900 $r .= "\n\t<option value='$role'>$name</option>"; 901 } 899 902 echo $p . $r; 900 903 } -
trunk/wp-admin/users.php
r6888 r6916 264 264 $class = ' class="current"'; 265 265 266 $name = translate_with_context($name); 266 267 $name = sprintf(_c('%1$s (%2$s)|user role with count'), $name, $avail_roles[$role]); 267 268 $role_links[] = "<li><a href=\"users.php?role=$role\"$class>" . $name . '</a>'; -
trunk/wp-includes/l10n.php
r6726 r6916 65 65 * @return string Translated text 66 66 */ 67 function translate($text, $domain ) {67 function translate($text, $domain = 'default') { 68 68 global $l10n; 69 69 … … 75 75 76 76 /** 77 * __() - Retrieve a translated string 78 * 79 * __() is a convenience function which retrieves the translated 80 * string from the translate(). 81 * 82 * @see translate() An alias of translate() 83 * @since 2.1.0 84 * 85 * @param string $text Text to translate 86 * @param string $domain Optional. Domain to retrieve the translated text 77 * translate_with_context() - Retrieve the translated text and strip context 78 * 79 * If the domain is set in the $l10n global, then the text is run 80 * through the domain's translate method. After it is passed to 81 * the 'gettext' filter hook, along with the untranslated text as 82 * the second parameter. 83 * 84 * If the domain is not set, the $text is just returned. 85 * 86 * @since 2.5 87 * @uses translate() 88 * 89 * @param string $text Text to translate 90 * @param string $domain Domain to retrieve the translated text 87 91 * @return string Translated text 88 92 */ 89 function __($text, $domain = 'default') { 90 return translate($text, $domain); 91 } 92 93 // . 94 /** 95 * _e() - Display a translated string 96 * 97 * _e() is a convenience function which displays the returned 98 * translated text from translate(). 99 * 100 * @see translate() Echos returned translate() string 101 * @since 1.2.0 102 * 103 * @param string $text Text to translate 104 * @param string $domain Optional. Domain to retrieve the translated text 105 */ 106 function _e($text, $domain = 'default') { 107 echo translate($text, $domain); 108 } 109 110 /** 111 * _c() - Retrieve context translated string 112 * 113 * Quite a few times, there will be collisions with similar 114 * translatable text found in more than two places but with 115 * different translated context. 116 * 117 * In order to use the separate contexts, the _c() function 118 * is used and the translatable string uses a pipe ('|') 119 * which has the context the string is in. 120 * 121 * When the translated string is returned, it is everything 122 * before the pipe, not including the pipe character. If 123 * there is no pipe in the translated text then everything 124 * is returned. 125 * 126 * @since 2.2.0 127 * 128 * @param string $text Text to translate 129 * @param string $domain Optional. Domain to retrieve the translated text 130 * @return string Translated context string without pipe 131 */ 132 function _c($text, $domain = 'default') { 93 function translate_with_context($text, $domain = 'default') { 133 94 $whole = translate($text, $domain); 134 95 $last_bar = strrpos($whole, '|'); … … 138 99 return substr($whole, 0, $last_bar); 139 100 } 101 } 102 103 /** 104 * __() - Retrieve a translated string 105 * 106 * __() is a convenience function which retrieves the translated 107 * string from the translate(). 108 * 109 * @see translate() An alias of translate() 110 * @since 2.1.0 111 * 112 * @param string $text Text to translate 113 * @param string $domain Optional. Domain to retrieve the translated text 114 * @return string Translated text 115 */ 116 function __($text, $domain = 'default') { 117 return translate($text, $domain); 118 } 119 120 // . 121 /** 122 * _e() - Display a translated string 123 * 124 * _e() is a convenience function which displays the returned 125 * translated text from translate(). 126 * 127 * @see translate() Echos returned translate() string 128 * @since 1.2.0 129 * 130 * @param string $text Text to translate 131 * @param string $domain Optional. Domain to retrieve the translated text 132 */ 133 function _e($text, $domain = 'default') { 134 echo translate($text, $domain); 135 } 136 137 /** 138 * _c() - Retrieve context translated string 139 * 140 * Quite a few times, there will be collisions with similar 141 * translatable text found in more than two places but with 142 * different translated context. 143 * 144 * In order to use the separate contexts, the _c() function 145 * is used and the translatable string uses a pipe ('|') 146 * which has the context the string is in. 147 * 148 * When the translated string is returned, it is everything 149 * before the pipe, not including the pipe character. If 150 * there is no pipe in the translated text then everything 151 * is returned. 152 * 153 * @since 2.2.0 154 * 155 * @param string $text Text to translate 156 * @param string $domain Optional. Domain to retrieve the translated text 157 * @return string Translated context string without pipe 158 */ 159 function _c($text, $domain = 'default') { 160 return translate_with_context($text, $domain); 140 161 } 141 162
Note: See TracChangeset
for help on using the changeset viewer.