Skip to content

Instantly share code, notes, and snippets.

@fabianmarz
Last active April 13, 2018 10:22
Show Gist options
  • Save fabianmarz/852cc92125a5233e20b975cc0adcb761 to your computer and use it in GitHub Desktop.
Save fabianmarz/852cc92125a5233e20b975cc0adcb761 to your computer and use it in GitHub Desktop.
Generate and move Drupal translation files to related folder via potx.
#!/bin/bash -eux
CURRENT_DIR=${PWD}
NAME="$(basename $CURRENT_DIR)"
DOCROOT=$(drush dd)
FILEPATH=$(realpath --relative-to="$DOCROOT" "$CURRENT_DIR")
drush potx --api=8 --folder=$FILEPATH/*
mkdir -p ./translations
mv $DOCROOT/general.pot ./translations/$NAME.pot
@fabianmarz
Copy link
Author

This script requires $ composer require kgaut/potx && drush en potx and must be executed from the folder where you want to add the translations to.

The generated general.pot file coming from potx will automatically be moved and renamed to match the current module name (based on the folder name).

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