Skip to content

Add different output formats #39

Closed as duplicate
Closed as duplicate

Description

@swissspidy

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.

Activity

  1. swissspidy commented on Jul 25, 2018

    @swissspidy
    MemberAuthor

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

  2. swissspidy commented on Jul 26, 2018

    @swissspidy
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions