grunt-wp-i18n
grunt-wp-i18n copied to clipboard
Exclude page templates
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' ) )
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?
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.
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.