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

Add different output formats #39

Open
swissspidy opened this issue Jul 9, 2018 · 2 comments
Open

Add different output formats #39

swissspidy opened this issue Jul 9, 2018 · 2 comments

Comments

@swissspidy
Copy link
Member

As mentioned in #33, it could be useful if the warnings and messages generated by the make-pot command are available in another format, for example JSON.

This way users can programmatically run the command, easily extract the output and process it further.

My own use case would be to run wp i18n make-pot every time I push code to GitHub and import translations into GlotPress. I want to be able to send a notification if there are any wrong translator comments or anything else.

@swissspidy
Copy link
Member Author

I was wondering if I could just extend WP_CLI\Loggers\Base for this and call set_logger() to keep it simple. 🤔

@swissspidy
Copy link
Member Author

For my own use case it would be awesome if I could get something like this at the end:

{
  "source": "/path/to/foo-plugin/",
  "mainFile": "/path/to/foo-plugin/foo-plugin.php",
  "textdomain": "foo-plugin",
  "mergedWith": "/path/to/foo-plugin/languages/js-strings.pot",
  "destination": "/path/to/foo-plugin/languages/foo-plugin.pot",
  "extractedStrings": 127,
  "warnings": [
    {
      "type": "invalid-comment",
      "file": "/path/to/foo-plugin/src/some-file.php",
      "line": 123
    },
    {
      "type": "invalid-comment",
      "file": "/path/to/foo-plugin/src/some-file.php",
      "line": 410
    },
    {
      "type": "invalid-domain",
      "file": "/path/to/foo-plugin/src/another-file.php",
      "line": 10
    }
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant