Sunday, March 16, 2014

WordPress: How to exclude plugin/theme files from Poedit catalog

► The Problem:

I use some third-party files in my WordPress plugin (or theme). When I run Poedit to built language files, it scans the main plugin folder and puts all text strings found in the .po file, including those from the third-party.

► The Solution?

Vaclav Slavik, the author of Poedit, placed a "wontfix" resolution on that, years ago. See http://www.poedit.net/trac/ticket/359 and http://www.poedit.net/trac/ticket/253.

So, there is no official solution to this.

► So, what to do?

Separate the 3rd party files from yours.

For example, put all your .php files into the "includes" folder, and 3rd party files - into the "vendor" folder. Then, in Poedit -> Catalog -> Properties -> Sources paths tab, instead of the "." (current folder), write "includes".

Poedit will scan only the "includes" and will ignore the "vendor" folder.