WP_Theme_JSON_Resolver::translate()protected staticWP 5.8.0

Given a theme.json structure modifies it in place to update certain values by its translated strings according to the language set by the user.

Метод класса: WP_Theme_JSON_Resolver{}

Хуков нет.

Возвращает

Массив. Returns the modified $theme_json_structure.

Использование

$result = WP_Theme_JSON_Resolver::translate( $theme_json, $domain );
$theme_json(массив) (обязательный)
The theme.json to translate.
$domain(строка)
Text domain. Unique identifier for retrieving translated strings.
По умолчанию: 'default'

Список изменений

С версии 5.8.0 Введена.

Код WP_Theme_JSON_Resolver::translate() WP 6.7.1

protected static function translate( $theme_json, $domain = 'default' ) {
	if ( null === static::$i18n_schema ) {
		$i18n_schema         = wp_json_file_decode( __DIR__ . '/theme-i18n.json' );
		static::$i18n_schema = null === $i18n_schema ? array() : $i18n_schema;
	}

	return translate_settings_using_i18n_schema( static::$i18n_schema, $theme_json, $domain );
}