WP_Theme_JSON_Resolver::translate( array $theme_json, string $domain = 'default' )

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.


Parameters

$theme_json

(array) (Required) The theme.json to translate.

$domain

(string) (Optional) Text domain. Unique identifier for retrieving translated strings.

Default value: 'default'


Top ↑

Return

(array) Returns the modified $theme_json_structure.


Top ↑

Source

File: wp-includes/class-wp-theme-json-resolver.php

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

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


Top ↑

Changelog

Changelog
Version Description
5.8.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.