Skip to content

Instantly share code, notes, and snippets.

@premitheme
Last active August 5, 2024 13:44
Show Gist options
  • Save premitheme/0ffb6d88da9945da66fe77ff9782a046 to your computer and use it in GitHub Desktop.
Save premitheme/0ffb6d88da9945da66fe77ff9782a046 to your computer and use it in GitHub Desktop.
Generate POT file for WP themes and plugins on Mac

Generate POT file

1. Install gettext GNU tools with Homebrew using Terminal

  1. Install Homebrew: Install Homebrew : /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Install GNU gettext: brew install gettext
  3. Then you must add that package to your path: echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
  4. Restart your computer! (Otherwise you will get "sh: msguniq: command not found" error).

2. In the Terminal we need to do an SVN checkout of WordPress trunk

svn co http://develop.svn.wordpress.org/trunk/ wpdev

This will create folder called "wpdev" under your user folder and has all the needed WP i18n tools files.

3. Run makepot.php file over your theme’s or plugin's folder

In the terminal change the directory to i18n tools directory

cd wpdev/tools/i18n/

  • For themes: php makepot.php wp-theme /path/to/your/theme/folder/ themename.pot
  • For plugins: php makepot.php wp-plugin /path/to/your/plugin/folder/ pluginname.pot

The new .pot file is created and be found inside the wpdev/tools/i18n/ directory. Just copy and paste it inside the languages folder of your theme or plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment