Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WP_Theme_JSON_Resolver::translate_theme_json_chunk() WordPress Method
The WP_Theme_JSON_Resolver::translate_theme_json_chunk() method is used to translate a theme JSON string into a WordPress theme. The method accepts two arguments: the JSON string to be translated and the theme slug. The JSON string is first decoded and then passed through the WordPress translation functions. The translated string is then returned.
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.
Contents
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.
Return
(array) Returns the modified $theme_json chunk.
Source
File: wp-includes/class-wp-theme-json-resolver.php
_deprecated_argument( __METHOD__, '5.9.0' ); } $options = wp_parse_args( $options, array( 'with_supports' => true ) ); if ( null === static::$theme ) { $theme_json_data = static::read_json_file( static::get_file_path_from_theme( 'theme.json' ) ); $theme_json_data = static::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) ); static::$theme = new WP_Theme_JSON( $theme_json_data ); if ( wp_get_theme()->parent() ) { // Get parent theme.json.
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.8.0 | Introduced. |