grunt-wp-i18n icon indicating copy to clipboard operation
grunt-wp-i18n copied to clipboard

Exclude page templates

Open grappler opened this issue 8 years ago • 3 comments

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' ) )

grappler avatar Mar 07 '16 21:03 grappler

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?

bradyvercher avatar Mar 09 '16 06:03 bradyvercher

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.

grappler avatar Mar 09 '16 17:03 grappler

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.

bradyvercher avatar Mar 10 '16 05:03 bradyvercher