Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around syntax error caused by the pot-to-php script #1427

merged 4 commits into from Sep 13, 2018


Copy link

@swissspidy swissspidy commented Sep 13, 2018

This is an attempt to fix #1416 for the time being.

I still have to look into how the pot-to-php script handles comments exactly and how it can be solved. We likely don't need that script anymore in the long run though.

Also, I need to find some time to look into the WP-CLI command. It should be possible to skip the file comment entirely by using --file-comment="" instead of using a somewhat hacky --file-comment="*/\'\'/*" workaround. This would also mostly eliminate the need to fix the pot-to-php script.

Fixes #1416.

@swissspidy swissspidy requested a review from westonruter Sep 13, 2018
Copy link

@westonruter westonruter commented Sep 13, 2018

@swissspidy the fix doesn't seem to be working:

$generated_i18n_strings = array(
	/* translators: *//* */

	/* Plugin Name of the plugin */
	__( 'AMP', 'amp' ),

Checking syntax:

php -l build/languages/amp-translations.php
PHP Fatal error:  Cannot use empty array elements in arrays in build/languages/amp-translations.php on line 5

Copy link

@westonruter westonruter commented Sep 13, 2018

Adding more slashes fixes the problem: e301ee6.

Copy link
Collaborator Author

@swissspidy swissspidy commented Sep 13, 2018

Thanks for the review!

The slashes might be an environment thing. I thought it worked fine when I tested it the other day...

In the meantime I submitted a PR to the WP-CLI command to make --file-comment="" work: wp-cli/i18n-command#82

@westonruter westonruter added this to the v1.0 milestone Sep 13, 2018
@westonruter westonruter merged commit a688267 into develop Sep 13, 2018
2 checks passed
@westonruter westonruter deleted the fix/pot-to-php-syntax-error branch Sep 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants