Skip to content

Instantly share code, notes, and snippets.

@kadimi
Last active October 9, 2018 17:00
Show Gist options
  • Save kadimi/a3a33a44a7461cb7b6037dcfd1967597 to your computer and use it in GitHub Desktop.
Save kadimi/a3a33a44a7461cb7b6037dcfd1967597 to your computer and use it in GitHub Desktop.
Shell command to create pot file for WordPress themes or plugins
find . -iname "*.php" | xargs xgettext \
--language=PHP \
--package-name=Example \
--package-version=1.0.0 \
--from-code=UTF-8 \
--keyword="__" \
--keyword="__ngettext:1,2" \
--keyword="__ngettext_noop:1,2" \
--keyword="_c,_nc:4c,1,2" \
--keyword="_e" \
--keyword="_ex:1,2c" \
--keyword="_n:1,2" \
--keyword="_n_noop:1,2" \
--keyword="_nx:4c,1,2" \
--keyword="_nx_noop:4c,1,2" \
--keyword="_x:1,2c" \
--keyword="esc_attr__" \
--keyword="esc_attr_e" \
--keyword="esc_attr_x:1,2c" \
--keyword="esc_html__" \
--keyword="esc_html_e" \
--keyword="esc_html_x:1,2c" \
--no-wrap \
--sort-by-file \
-o languages/example.pot \
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment