How to Create a .pot file for theme or plugin with POEdit

Here is how you can create a .pot file for your theme with POEdit (free edition, version 1.7.7) on OS X.

Best practice is to save language files in a folder named “languages” in your theme directory. If you haven’t already, create it before you start.

In POEdit:

  1. In the “File” menu select “New”
  2. Select the language that you used in your theme (probably English)
  3. In the “Catalog” menu select “Properties”
  4. Enter the project information in the “Translation properties” tab
  5. Go to the 3rd tab “Sources keywords”
  6. Click on the “New item” button (2nd button) and enter a keyword and repeat this for each of your keywords (__, _e, esc_attr_e, etc.)
  7. https://developer.wordpress.org/themes/functionality/internationalization/ 
  8. Click on the “OK” button at the bottom
  9. In the “File” menu select “Save As..”
  10. Save the file as “yourthemename.pot” in the “languages” folder in your theme directory (make sure you add the .pot extension to the filename because by default it will save as .po. You can also change extension after saving the file.)
  11. In the “Catalog” menu select “Properties” again
  12. Go to the 2nd tab “Sources paths”
  13. Set the value for “Base path” to ../ (the .pot file is saved in a subdirectory so this way you set the base to the parent directory, ie. your theme directory)
  14. Next to “Path” click on the “New item” button and enter . (this will make it scan your theme directory and its subdirectories)
  15. Click on the “OK” button at the bottom
  16. Click on the “Catalog” → “Update from Sources”
  17. In the “File” menu click “Save”
  18. Delete the .pot.mo and .pot and rename the .pot.po file to .pot only

 

And you’re done 🙂

 

Sources: http://wordpress.stackexchange.com/a/169280