cedaro / grunt-wp-i18n

Internationalize WordPress themes and plugins with Grunt.
MIT License
160 stars 25 forks source link

Running "makepot" task keeps running forever #74

Closed jamesthemullet closed 6 years ago

jamesthemullet commented 6 years ago

Firstly I potentially love this plugin - if I can get it to work! I am very new to grunt, so it could be something dumb on my part, however when I run grunt it keeps bringing up 'Running "makepot" task' repeatedly. It's been going on for an hour now.

In the Gruntfile, under initConfig, I have:

makepot: {
        target: {
            options: {
                cwd: 'web/wp-content/themes/mytheme/includes/store',
                domainPath: 'web/wp-content/themes/mytheme/languages',
                type: 'wp-theme',
            }
        }

The task is loaded:

grunt.loadNpmTasks('grunt-wp-i18n');

Then I register the task below:

grunt.registerTask('makepot', function() {
        grunt.task.run('makepot');
    })

The folder that I have selected only has one file in. Any ideas?

Thanks James

bradyvercher commented 6 years ago

The makepot task should only take a few seconds at most, so it sounds like something isn't quite right. The only thing I notice about your config is that the domainPath option should be relative to the working directory, so /languages should work for that.

I haven't run into any issues where the process would hang like that, so I'm not sure where to start. Are you certain that the PHP CLI is in your system path?

BackpackerZen commented 6 years ago

Bonjour together,

thanks for creating this plugin. Unfortunately I run into the same problem.

Here is my task:

makepot: {
  target: {
    options: {
      domainPath: '/languages',         // Where to save the POT file.
      exclude: [],                      // List of files or directories to ignore.
      include: ['*.php'],      // List of files or directories to include.
      potFilename: 'plugin-or-theme-slug.pot',         // Name of the POT file.
      potHeaders: {
          poedit: true,                 // Includes common Poedit headers.
          'x-poedit-keywordslist': true // Include a list of all possible gettext functions.
      },                                // Headers to add to the generated POT file.
      type: 'wp-theme',                 // Type of project (wp-plugin or wp-theme).
    }
  }
}

I have the PHP CLI installed and available on my cmd.

What am I missing? How can I make the plugin work?

Thank you! Max

BackpackerZen commented 6 years ago

Solved the problem. It's not the plugin, it's the user. Simple fix:

Call grunt makepot directly and don't create a task with a single command like this: grunt.registerTask('makepot', ['makepot']);.

bradyvercher commented 6 years ago

Good catch @BackpackerZen! That does appear to be the issue here. Thanks for following up!