Skip to content

Instantly share code, notes, and snippets.

@leandro
Forked from elebescond/gist:1433137
Last active October 5, 2017 00:55
Show Gist options
  • Save leandro/14d5477b2cfb15b22a7fedaa90201c69 to your computer and use it in GitHub Desktop.
Save leandro/14d5477b2cfb15b22a7fedaa90201c69 to your computer and use it in GitHub Desktop.
Generate a .pot template from a wordpress theme/codebase and update .po files
find . -iname "*.php" > /tmp/my_php_files.txt
# new template
xgettext --from-code=utf-8 -d my_dir -f /tmp/my_php_files.txt -o languages/my_theme.pot
# update template
xgettext --from-code=utf-8 -d my_dir -j -f /tmp/my_php_files.txt -o languages/my_theme.pot
# To update the already translated .po files and add new strings to them, run:
msgmerge --update --no-fuzzy-matching --backup=off lancguages/pt_BR.po languages/my_theme.pot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment