plugin updates

This commit is contained in:
Tony Volpe
2024-11-15 13:53:04 -05:00
parent 1293d604ca
commit 0238f0c4ca
2009 changed files with 163492 additions and 89543 deletions

View File

@@ -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 );
}
}

View File

@@ -154,7 +154,7 @@ class WP_Translation_File_MO extends WP_Translation_File {
// Metadata about the MO file is stored in the first translation entry.
if ( '' === $original ) {
foreach ( explode( "\n", $translation ) as $meta_line ) {
if ( '' === $meta_line ) {
if ( '' === $meta_line || ! str_contains( $meta_line, ':' ) ) {
continue;
}