WP_Theme_JSON_Resolver::translate_theme_json_chunk( array $array_to_translate, string $key, string $context, string $domain )

Translates a chunk of the loaded theme.json structure.


Parameters

$array_to_translate

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

$key

(string) (Required) The key of the field that contains the string to translate.

$context

(string) (Required) The context to apply in the translation call.

$domain

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


Top ↑

Return

(array) Returns the modified $theme_json chunk.


Top ↑

Source

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

			if ( wp_get_theme()->parent() ) {
				// Get parent theme.json.
				$parent_theme_json_data = self::read_json_file( self::get_file_path_from_theme( 'theme.json', true ) );
				$parent_theme_json_data = self::translate( $parent_theme_json_data, wp_get_theme()->parent()->get( 'TextDomain' ) );
				$parent_theme           = new WP_Theme_JSON( $parent_theme_json_data );

				// Merge the child theme.json into the parent theme.json.
				// The child theme takes precedence over the parent.
				$parent_theme->merge( self::$theme );
				self::$theme = $parent_theme;
			}

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.