Translation files are a very important part of the WordPress ecosystem. They allow your plugin or theme to be used by people in all languages. So, you need them. It’s less of a suggestion and more of a requirement 😉
That’s the easy way if you already use a task runner. You load up the dependency, create a task, and you run the task! Here’s a good tutorial on using Grunt with WordPress Development: http://code.tutsplus.com/tutorials/using-grunt-with-wordpress-development–cms-21743 (A little old, 2014, but still good).
If you don’t use a task runner, I would suggest using the WordPess i18n Library of tools and specifically
makepot and a neat little Bash script to do the hard work for you. Here’s how you can do it:
- You’ll need to clone the SVN repo to your computer first
sudo svn co http://i18n.svn.wordpress.org/tools/trunk/
- Install gettext using Homebrew:
brew install gettext
If you don’t have Homebrew installed, you should install it.
- Then you will need to link it
brew link gettext --force
- Now go into your .bash_profile or .zshrc and make sure to add the Path to where the library is
# Path to WP_I18N_LIB export WP_I18N_LIB="/Users/mikeyarce/repos/WP_I18N_LIB"
- Now you can clone this little Bash script to make it easier for you to call makepot from any directory: https://gist.github.com/johnpbloch/3436835
- Rename makepot.sh to makepot and move it into /usr/local/bin so that it’s globally accessible.
Now, to make a
pot file, you can just navigate to the Plugin or Theme directory via Terminal, and just type in