_c()WP 2.2.0

Устарела с версии 2.9.0. Больше не поддерживается и может быть удалена. Используйте _x().

Retrieve translated string with vertical bar context

Quite a few times, there will be collisions with similar translatable text found in more than two places but with different translated context.

In order to use the separate contexts, the _c() function is used and the translatable string uses a pipe ('|') which has the context the string is in.

When the translated string is returned, it is everything before the pipe, not including the pipe character. If there is no pipe in the translated text then everything is returned.

Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.

Хуков нет.

Возвращает

Строку. Translated context string without pipe.

Использование

_c( $text, $domain );
$text(строка) (обязательный)
Text to translate.
$domain(строка)
Domain to retrieve the translated text.
По умолчанию: 'default'

Заметки

  • Смотрите: _x()

Список изменений

С версии 2.2.0 Введена.
Устарела с 2.9.0 Use _x()

Код _c() WP 6.5.2

function _c( $text, $domain = 'default' ) {
	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
	return before_last_bar( translate( $text, $domain ) );
}