bbp_translate_user_role( string $name )

Translates role name.

Description

Since the role names are in the database and not in the source there are dummy gettext calls to get them into the POT file and this function properly translates them back.

The before_last_bar() call is needed, because older installs keep the roles using the old context format: ‘Role name|User role’ and just skipping the content after the last bar is easier than fixing them in the DB. New installs won’t suffer from that problem.

See also

Parameters

$name

(Required) The role name.

Return

(string) Translated role name on success, original name on failure.

Source

File: bp-forums/common/locale.php

function bbp_translate_user_role( $name ) {
	return translate_with_gettext_context( before_last_bar( $name ), 'User role', 'buddyboss' );
}

Changelog

Changelog
Version Description
BuddyPress 2.6.0 Forums Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.