You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The loop in WP_Theme_JSON_Resolver to extract translatable paths is broken, as it contains an immediate and unconditional return. This causes the loop to immediately exit again after the first iteration, thus never actually looping.
Yes, good catch. It’s an obvious bug from #28246 that I didn’t catch only because we had only one field used for all translatable paths 😅
We need a test that uses a custom schema and requires several fields to be translated, a good example would be in the i18n schema for block.json:
Activity
swissspidy commentedon Jul 19, 2021
cc @gziolo @nosolosw
gziolo commentedon Jul 19, 2021
Yes, good catch. It’s an obvious bug from #28246 that I didn’t catch only because we had only one field used for all translatable paths 😅
We need a test that uses a custom schema and requires several fields to be translated, a good example would be in the i18n schema for
block.json:gutenberg/packages/blocks/src/api/i18n-block.json
Lines 10 to 16 in d361e91
At some point, we could also unify the logic that applies translations based on i18n schemas.
I recently proposed https://github.com/WordPress/wordpress-develop/blob/92a8fda178379f7366054f26580ae756da0dcbda/src/wp-includes/blocks.php#L219-L247 that could work for both, but it doesn’t cover the case with
*thattheme.jsonhas.I18n: Fix broken loop in WP_Theme_JSON_Resolver
I18n: Fix broken loop in WP_Theme_JSON_Resolver
I18n: Fix broken loop in WP_Theme_JSON_Resolver
gziolo commentedon Jul 22, 2021
It was also backported to WordPress core: WordPress/wordpress-develop@3f83b50.
I18n: Fix broken loop in WP_Theme_JSON_Resolver
I18n: Fix broken loop in `WP_Theme_JSON_Resolver`
I18n: Fix broken loop in `WP_Theme_JSON_Resolver`
I18n: Fix broken loop in `WP_Theme_JSON_Resolver`
I18n: Fix broken loop in `WP_Theme_JSON_Resolver`
I18n: Fix broken loop in `WP_Theme_JSON_Resolver`
I18n: Fix broken loop in `WP_Theme_JSON_Resolver`