Returns a boolean to indicate whether a translation exists for a given string with optional text domain and locale.
Parameters
$singularstringrequired- Singular translation to check.
$textdomainstringoptional- Text domain. Default
'default'. $locale?stringoptional- Locale. Default current locale.
Default:
null
Source
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 );
}
Changelog
| Version | Description |
|---|---|
| 6.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.