wordpress-plugin-boilerplate icon indicating copy to clipboard operation
wordpress-plugin-boilerplate copied to clipboard

yarn translate : The system cannot find the file specified.

Open IonTulbure opened this issue 1 year ago • 4 comments

Describe the bug package.json has this script:

"translate": "wp-pot --src '**/**/**/*.php' --dest-file 'languages/test-plugin.pot' --package 'test-plugin' --domain 'test-plugin' --last-translator 'Test Plugin <[email protected]>' --team 'Test Plugin <[email protected]>' --bug-report 'testplugin.com'"

When i run yarn translate i get the following error:

yarn run v1.22.19 $ wp-pot --src '**/**/**/*.php' --dest-file 'languages/test-plugin.pot' --package 'test-plugin' --domain 'test-plugin' --last-translator 'Test Plugin <[email protected]>' --team 'Test Plugin <[email protected]>' --bug-report 'testplugin.com' The system cannot find the file specified. error Command failed with exit code 1.

To Reproduce run yarn translate (wp-pot)

This will throw the following error: The system cannot find the file specified. error Command failed with exit code 1.

Module versions └─┬ [email protected] └─┬ [email protected] └── [email protected]

Additional context What can cause this issue, can't find anything related to it.

IonTulbure avatar Mar 17 '23 13:03 IonTulbure

@brandonkramer Hi, can you help ?

IonTulbure avatar Mar 17 '23 13:03 IonTulbure

Temporary workaround:

Install globally wp-pot-cli npm install --global wp-pot-cli

Then from the command line run wp-pot --src '**/**/**/*.php' --dest-file 'languages/test-plugin.pot'

IonTulbure avatar Mar 17 '23 14:03 IonTulbure

I found the "issue" :

In package.json if we remove options: --last-translator 'Test Plugin <[email protected]>' &
--team 'Test Plugin <[email protected]>'

Script without the two options above will run with no errors. "translate": "wp-pot --src '**/**/**/*.php' --dest-file 'languages/test-plugin.pot' --package 'test-plugin' --domain 'test-plugin' --bug-report 'testplugin.com'"

yarn translate works now.

This is strange, does anyone the reason ?

IonTulbure avatar Mar 17 '23 16:03 IonTulbure

A deeper dive showed that email in translate options is causing the error. Without <[email protected]> in --team & last-translator options script will be executed.

translate": "wp-pot --src '**/**/**/*.php' --dest-file 'languages/test-plugin.pot' --package 'test-plugin' --domain 'test-plugin' --bug-report 'testplugin.com' --team 'Test Plugin' --lastTranslator 'Test Plugin'"

IonTulbure avatar Mar 17 '23 16:03 IonTulbure