Skip to content

Commit

Permalink
I18n: Fix broken loop in WP_Theme_JSON_Resolver
Browse files Browse the repository at this point in the history
Related issue in Gutenberg: WordPress/gutenberg#33552.

The loop in `WP_Theme_JSON_Resolver` to extract translatable paths was broken, as it contained an immediate and unconditional return. This caused the loop to immediately exit again after the first iteration, thus never actually looping.

Follow-up to [50959].

Props schlessera.
Merges [51472] to the 5.8 branch.
Fixes #53738.

git-svn-id: https://develop.svn.wordpress.org/branches/5.8@51515 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Jul 30, 2021
1 parent 352c898 commit b24f13b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/wp-includes/class-wp-theme-json-resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,13 @@ private static function extract_paths_to_translate( $i18n_partial, $current_path
foreach ( $i18n_partial as $property => $partial_child ) {
if ( is_numeric( $property ) ) {
foreach ( $partial_child as $key => $context ) {
return array(
array(
'path' => $current_path,
'key' => $key,
'context' => $context,
),
$result[] = array(
'path' => $current_path,
'key' => $key,
'context' => $context,
);
}
return $result;
}
$result = array_merge(
$result,
Expand Down

0 comments on commit b24f13b

Please sign in to comment.