wc_translate_user_roles()
Translate WC roles using the woocommerce textdomain.
No Hooks.
Return
String
.
Usage
wc_translate_user_roles( $translation, $text, $context, $domain );
- $translation(string) (required)
- Translated text.
- $text(string) (required)
- Text to translate.
- $context(string) (required)
- Context information for the translators.
- $domain(string) (required)
- Text domain. Unique identifier for retrieving translated strings.
Changelog
Since 3.7.0 | Introduced. |
wc_translate_user_roles() wc translate user roles code WC 9.4.2
function wc_translate_user_roles( $translation, $text, $context, $domain ) { // translate_user_role() only accepts a second parameter starting in WP 5.2. if ( version_compare( get_bloginfo( 'version' ), '5.2', '<' ) ) { return $translation; } if ( 'User role' === $context && 'default' === $domain && in_array( $text, array( 'Shop manager', 'Customer' ), true ) ) { return translate_user_role( $text, 'woocommerce' ); } return $translation; }