WP_Translations::translate
Translates a singular string.
Метод класса: WP_Translations{}
Хуков нет.
Возвращает
Строку|null. Translation if it exists, or the unchanged singular string
Использование
$WP_Translations = new WP_Translations(); $WP_Translations->translate( $singular, $context );
- $singular(строка|null) (обязательный)
- Singular string.
- $context(строка|null)
- Context.
По умолчанию: ''
Список изменений
| С версии 6.5.0 | Введена. |
Код WP_Translations::translate() WP Translations::translate WP 6.8.3
public function translate( $singular, $context = '' ) {
if ( null === $singular ) {
return null;
}
$translation = $this->controller->translate( $singular, (string) $context, $this->textdomain );
if ( false !== $translation ) {
return $translation;
}
// Fall back to the original.
return $singular;
}