equal
deleted
inserted
replaced
432 $locale = $this->current_locale; |
432 $locale = $this->current_locale; |
433 } |
433 } |
434 |
434 |
435 return $this->loaded_translations[ $locale ][ $textdomain ] ?? array(); |
435 return $this->loaded_translations[ $locale ][ $textdomain ] ?? array(); |
436 } |
436 } |
|
437 |
|
438 /** |
|
439 * Returns a boolean to indicate whether a translation exists for a given string with optional text domain and locale. |
|
440 * |
|
441 * @since 6.7.0 |
|
442 * |
|
443 * @param string $singular Singular translation to check. |
|
444 * @param string $textdomain Optional. Text domain. Default 'default'. |
|
445 * @param ?string $locale Optional. Locale. Default current locale. |
|
446 * @return bool True if the translation exists, false otherwise. |
|
447 */ |
|
448 public function has_translation( string $singular, string $textdomain = 'default', ?string $locale = null ): bool { |
|
449 if ( null === $locale ) { |
|
450 $locale = $this->current_locale; |
|
451 } |
|
452 |
|
453 return false !== $this->locate_translation( $singular, $textdomain, $locale ); |
|
454 } |
437 } |
455 } |