Title: WP_Theme_JSON_Resolver::extract_paths_to_translate
Published: July 20, 2021
Last modified: November 4, 2021

---

# WP_Theme_JSON_Resolver::extract_paths_to_translate( array $i18n_partial, array $current_path = array() ): array

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/extract_paths_to_translate/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/extract_paths_to_translate/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/extract_paths_to_translate/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/extract_paths_to_translate/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/extract_paths_to_translate/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/extract_paths_to_translate/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Converts a tree as in i18n-theme.json into a linear array containing metadata to
translate a theme.json file.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/extract_paths_to_translate/?output_format=md#description)󠁿

For example, given this input:

    ```php
    {
      "settings": {
        "*": {
          "typography": {
            "fontSizes": [ { "name": "Font size name" } ],
            "fontStyles": [ { "name": "Font size name" } ]
          }
        }
      }
    }
    ```

will return this output:

    ```php
    [
      0 => [
        'path'    => [ 'settings', '*', 'typography', 'fontSizes' ],
        'key'     => 'name',
        'context' => 'Font size name'
      ],
      1 => [
        'path'    => [ 'settings', '*', 'typography', 'fontStyles' ],
        'key'     => 'name',
        'context' => 'Font style name'
      ]
    ]
    ```

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/extract_paths_to_translate/?output_format=md#parameters)󠁿

 `$i18n_partial`arrayrequired

A tree that follows the format of i18n-theme.json.

`$current_path`arrayoptional

Keeps track of the path as we walk down the given tree.

Default:`array()`

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/extract_paths_to_translate/?output_format=md#return)󠁿

 array A linear array containing the paths to translate.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/extract_paths_to_translate/?output_format=md#source)󠁿

    ```php
    /**
     * Returns a data structure used in theme.json translation.
     *
     * @since 5.8.0
     * @deprecated 5.9.0
     *
     * @return array An array of theme.json fields that are translatable and the keys that are translatable.
     */
    public static function get_fields_to_translate() {
    	_deprecated_function( __METHOD__, '5.9.0' );
    	return array();
    }

    /**
     * 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.
     *
     * @since 5.8.0
     *
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-theme-json-resolver.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-theme-json-resolver.php#L119)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-theme-json-resolver.php#L119-L138)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/extract_paths_to_translate/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme_json_resolver%2Fextract_paths_to_translate%2F)
before being able to contribute a note or feedback.