| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* bbPress Localization. |
| 5 |
* |
| 6 |
* @package bbPress |
| 7 |
* @subpackage Localization |
| 8 |
*/ |
| 9 |
|
| 10 |
// Exit if accessed directly |
| 11 |
defined( 'ABSPATH' ) || exit; |
| 12 |
|
| 13 |
/** |
| 14 |
* Translates role name. |
| 15 |
* |
| 16 |
* Since the role names are in the database and not in the source there |
| 17 |
* are dummy gettext calls to get them into the POT file and this function |
| 18 |
* properly translates them back. |
| 19 |
* |
| 20 |
* The before_last_bar() call is needed, because older installs keep the roles |
| 21 |
* using the old context format: 'Role name|User role' and just skipping the |
| 22 |
* content after the last bar is easier than fixing them in the DB. New installs |
| 23 |
* won't suffer from that problem. |
| 24 |
* |
| 25 |
* @see translate_user_role() |
| 26 |
* |
| 27 |
* @since 2.6.0 bbPress |
| 28 |
* |
| 29 |
* @param string $name The role name. |
| 30 |
* @return string Translated role name on success, original name on failure. |
| 31 |
*/ |
| 32 |
function bbp_translate_user_role( $name ) { |
| 33 |
// WordPress.WP.I18n.NoEmptyStrings |
| 34 |
// -- empty string is intentional here as actual content comes from database |
| 35 |
return _x( before_last_bar( $name ), 'User role', 'bbpress' ); // phpcs:ignore |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Dummy gettext calls to get strings in the catalog. |
| 40 |
* |
| 41 |
* @since 2.6.0 bbPress |
| 42 |
*/ |
| 43 |
function bbp_dummy_role_names() { |
| 44 |
|
| 45 |
/* translators: user role */ |
| 46 |
_x( 'Keymaster', 'User role', 'bbpress' ); |
| 47 |
|
| 48 |
/* translators: user role */ |
| 49 |
_x( 'Moderator', 'User role', 'bbpress' ); |
| 50 |
|
| 51 |
/* translators: user role */ |
| 52 |
_x( 'Participant', 'User role', 'bbpress' ); |
| 53 |
|
| 54 |
/* translators: user role */ |
| 55 |
_x( 'Spectator', 'User role', 'bbpress' ); |
| 56 |
|
| 57 |
/* translators: user role */ |
| 58 |
_x( 'Blocked', 'User role', 'bbpress' ); |
| 59 |
} |
| 60 |
|