WP_Translation_Controller::has_translation
Returns a boolean to indicate whether a translation exists for a given string with optional text domain and locale.
Метод класса: WP_Translation_Controller{}
Хуков нет.
Возвращает
true|false. True if the translation exists, false otherwise.
Использование
$WP_Translation_Controller = new WP_Translation_Controller(); $WP_Translation_Controller->has_translation( $singular, $textdomain, ?string $locale ): bool;
- $singular(строка) (обязательный)
- Singular translation to check.
- $textdomain(строка)
- Text domain.
По умолчанию: 'default' - ?string $locale
- .
По умолчанию: null
Список изменений
| С версии 6.7.0 | Введена. |
Код WP_Translation_Controller::has_translation() WP Translation Controller::has translation WP 6.9
public function has_translation( string $singular, string $textdomain = 'default', ?string $locale = null ): bool {
if ( null === $locale ) {
$locale = $this->current_locale;
}
return false !== $this->locate_translation( $singular, $textdomain, $locale );
}