plugin updates
This commit is contained in:
@@ -434,4 +434,22 @@ final class WP_Translation_Controller {
|
||||
|
||||
return $this->loaded_translations[ $locale ][ $textdomain ] ?? array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean to indicate whether a translation exists for a given string with optional text domain and locale.
|
||||
*
|
||||
* @since 6.7.0
|
||||
*
|
||||
* @param string $singular Singular translation to check.
|
||||
* @param string $textdomain Optional. Text domain. Default 'default'.
|
||||
* @param ?string $locale Optional. Locale. Default current locale.
|
||||
* @return bool True if the translation exists, false otherwise.
|
||||
*/
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user