wpseek.com
WordPress开发者和主题制作者的搜索引擎



has_translation › WordPress Function

Since6.7.0
已弃用n/a
has_translation ( $singular, $textdomain = 'default', $locale = null )
参数: (3)
  • (string) $singular Singular translation to check.
    Required: Yes
  • (string) $textdomain Optional. Text domain. Default 'default'.
    Required: No
    默认: 'default'
  • (?string) $locale Optional. Locale. Default current locale.
    Required: No
    默认: null
返回:
  • (bool) True if the translation exists, false otherwise.
定义在:
文档:

Returns a boolean to indicate whether a translation exists for a given string with optional text domain and locale.



源码

function has_translation( string $singular, string $textdomain = 'default', ?string $locale = null ): bool {
	return WP_Translation_Controller::get_instance()->has_translation( $singular, $textdomain, $locale );
}