cedaro / grunt-wp-i18n

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

Exclude page templates #67

Open grappler opened 8 years ago

grappler commented 8 years ago

I was trying to exclude a page template from the makepot. After looking at the code I realized it is not possible.

It would be nice if the code would first check if the file excluded before running $potextmeta->append( $dir . '/' . $file, $output, array( 'Template Name' ) )

bradyvercher commented 8 years ago

The PHP code really is a bit of a mess and it would probably require a decent bit of duplication/refactoring to make that work. Could you use the processPot callback to remove that string?

grappler commented 8 years ago

I just needed to generate the pot file once so I just deleted the page template temporarily. I reported the issue so that the next person might find out earlier of the issue.

I would be interested to know how you would remove a string. I saw the code in remove-package-metadata.md but it was a bit complex for me to understand staight away. Is the pot variable documented somewhere.

bradyvercher commented 8 years ago

Yeah, that example is a little complex without being familiar with the code, but that variable is an object representation of the POT file created by the gettext-parser module. The structure is documented here.