diff -r 48c4eec2b7e6 -r 8c2e4d02f4ef wp/wp-includes/l10n/class-wp-translation-controller.php --- a/wp/wp-includes/l10n/class-wp-translation-controller.php Fri Sep 05 18:40:08 2025 +0200 +++ b/wp/wp-includes/l10n/class-wp-translation-controller.php Fri Sep 05 18:52:52 2025 +0200 @@ -434,4 +434,22 @@ 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 ); + } }