git-svn-id: http://svn.automattic.com/wordpress/trunk@6916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3992509821
commit
7c8c648554
|
@ -267,11 +267,19 @@ function populate_roles() {
|
||||||
|
|
||||||
function populate_roles_160() {
|
function populate_roles_160() {
|
||||||
// Add roles
|
// Add roles
|
||||||
add_role('administrator', _c('Administrator|User role'));
|
|
||||||
add_role('editor', _c('Editor|User role'));
|
// Dummy gettext calls to get strings in the catalog.
|
||||||
add_role('author', _c('Author|User role'));
|
_c('Administrator|User role');
|
||||||
add_role('contributor', _c('Contributor|User role'));
|
_c('Editor|User role');
|
||||||
add_role('subscriber', _c('Subscriber|User role'));
|
_c('Author|User role');
|
||||||
|
_c('Contributor|User role');
|
||||||
|
_c('Subscriber|User role');
|
||||||
|
|
||||||
|
add_role('administrator', 'Administrator|User role');
|
||||||
|
add_role('editor', 'Editor|User role');
|
||||||
|
add_role('author', 'Author|User role');
|
||||||
|
add_role('contributor', 'Contributor|User role');
|
||||||
|
add_role('subscriber', 'Subscriber|User role');
|
||||||
|
|
||||||
// Add caps for Administrator role
|
// Add caps for Administrator role
|
||||||
$role = get_role('administrator');
|
$role = get_role('administrator');
|
||||||
|
|
|
@ -545,12 +545,13 @@ function user_row( $user_object, $style = '', $role = '' ) {
|
||||||
} else {
|
} else {
|
||||||
$edit = $user_object->user_login;
|
$edit = $user_object->user_login;
|
||||||
}
|
}
|
||||||
|
$role_name = translate_with_context($wp_roles->role_names[$role]);
|
||||||
$r = "<tr id='user-$user_object->ID'$style>
|
$r = "<tr id='user-$user_object->ID'$style>
|
||||||
<td><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></td>
|
<td><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></td>
|
||||||
<td><strong>$edit</strong></td>
|
<td><strong>$edit</strong></td>
|
||||||
<td>$user_object->first_name $user_object->last_name</td>
|
<td>$user_object->first_name $user_object->last_name</td>
|
||||||
<td><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td>
|
<td><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td>
|
||||||
<td>{$wp_roles->role_names[$role]}</td>";
|
<td>$role_name</td>";
|
||||||
$r .= "\n\t\t<td>";
|
$r .= "\n\t\t<td>";
|
||||||
if ( $numposts > 0 ) {
|
if ( $numposts > 0 ) {
|
||||||
$r .= "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "' class='edit'>";
|
$r .= "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "' class='edit'>";
|
||||||
|
@ -891,11 +892,13 @@ function the_attachment_links( $id = false ) {
|
||||||
function wp_dropdown_roles( $default = false ) {
|
function wp_dropdown_roles( $default = false ) {
|
||||||
global $wp_roles;
|
global $wp_roles;
|
||||||
$r = '';
|
$r = '';
|
||||||
foreach( $wp_roles->role_names as $role => $name )
|
foreach( $wp_roles->role_names as $role => $name ) {
|
||||||
|
$name = translate_with_context($name);
|
||||||
if ( $default == $role ) // Make default first in list
|
if ( $default == $role ) // Make default first in list
|
||||||
$p = "\n\t<option selected='selected' value='$role'>$name</option>";
|
$p = "\n\t<option selected='selected' value='$role'>$name</option>";
|
||||||
else
|
else
|
||||||
$r .= "\n\t<option value='$role'>$name</option>";
|
$r .= "\n\t<option value='$role'>$name</option>";
|
||||||
|
}
|
||||||
echo $p . $r;
|
echo $p . $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -263,6 +263,7 @@ foreach ( $wp_roles->get_names() as $role => $name ) {
|
||||||
if ( $role == $_GET['role'] )
|
if ( $role == $_GET['role'] )
|
||||||
$class = ' class="current"';
|
$class = ' class="current"';
|
||||||
|
|
||||||
|
$name = translate_with_context($name);
|
||||||
$name = sprintf(_c('%1$s (%2$s)|user role with count'), $name, $avail_roles[$role]);
|
$name = sprintf(_c('%1$s (%2$s)|user role with count'), $name, $avail_roles[$role]);
|
||||||
$role_links[] = "<li><a href=\"users.php?role=$role\"$class>" . $name . '</a>';
|
$role_links[] = "<li><a href=\"users.php?role=$role\"$class>" . $name . '</a>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ function get_locale() {
|
||||||
* @param string $domain Domain to retrieve the translated text
|
* @param string $domain Domain to retrieve the translated text
|
||||||
* @return string Translated text
|
* @return string Translated text
|
||||||
*/
|
*/
|
||||||
function translate($text, $domain) {
|
function translate($text, $domain = 'default') {
|
||||||
global $l10n;
|
global $l10n;
|
||||||
|
|
||||||
if (isset($l10n[$domain]))
|
if (isset($l10n[$domain]))
|
||||||
|
@ -73,6 +73,33 @@ function translate($text, $domain) {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* translate_with_context() - Retrieve the translated text and strip context
|
||||||
|
*
|
||||||
|
* If the domain is set in the $l10n global, then the text is run
|
||||||
|
* through the domain's translate method. After it is passed to
|
||||||
|
* the 'gettext' filter hook, along with the untranslated text as
|
||||||
|
* the second parameter.
|
||||||
|
*
|
||||||
|
* If the domain is not set, the $text is just returned.
|
||||||
|
*
|
||||||
|
* @since 2.5
|
||||||
|
* @uses translate()
|
||||||
|
*
|
||||||
|
* @param string $text Text to translate
|
||||||
|
* @param string $domain Domain to retrieve the translated text
|
||||||
|
* @return string Translated text
|
||||||
|
*/
|
||||||
|
function translate_with_context($text, $domain = 'default') {
|
||||||
|
$whole = translate($text, $domain);
|
||||||
|
$last_bar = strrpos($whole, '|');
|
||||||
|
if ( false == $last_bar ) {
|
||||||
|
return $whole;
|
||||||
|
} else {
|
||||||
|
return substr($whole, 0, $last_bar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __() - Retrieve a translated string
|
* __() - Retrieve a translated string
|
||||||
*
|
*
|
||||||
|
@ -130,13 +157,7 @@ function _e($text, $domain = 'default') {
|
||||||
* @return string Translated context string without pipe
|
* @return string Translated context string without pipe
|
||||||
*/
|
*/
|
||||||
function _c($text, $domain = 'default') {
|
function _c($text, $domain = 'default') {
|
||||||
$whole = translate($text, $domain);
|
return translate_with_context($text, $domain);
|
||||||
$last_bar = strrpos($whole, '|');
|
|
||||||
if ( false == $last_bar ) {
|
|
||||||
return $whole;
|
|
||||||
} else {
|
|
||||||
return substr($whole, 0, $last_bar);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue