Closed oandregal closed 2 years ago
cc @swissspidy this is the continuation of https://github.com/wp-cli/i18n-command/pull/306
The behat tests are now throwing the following warning (hence they fail):
PHP Warning: Invalid argument supplied for foreach() in src/ThemeJsonExtractor.php on line 209
This warning also happens in main
.
The reason for this warning is that the i18n schema used to translate theme.json
files (see) has been updated this morning. However, the code that interprets it has not been updated it yet: https://github.com/wp-cli/i18n-command/pull/306 needs to be merged to fix that warning.
Merged #306 now
This PR is a continuation of https://github.com/wp-cli/i18n-command/pull/306
It adds supports for looking for translatable strings in JSON files within the
styles
directory of a theme. Unlike the top-leveltheme.json
file we don't lock any names in this case: any JSON file within thestyles
folder is a candidate we should consider.How to test
Automated tests:
composer behat -- features/makepot.feature
Manual test:
composer install
foo-theme
that contains astyles
directory.styles
directory create amy-style.json
file with the following contents:vendor/bin/wp i18n make-pot foo-theme
foo-theme/foo-theme.pot
file and that the "My color" string is present as well as its context "Color name". You should see something like: