Open wedi opened 11 years ago
Agreed. Let me see if I am able to come up with that magic RegEx :)
I have used this shell script as a pre-commit git hook. In it's current form, it needs customized to your directory structure, but won't commit the regenerated pot file if nothing changed.
#!/usr/bin/env bash
php wp-i18n-tools/makepot.php wp-plugin plugin-name plugin-folder/languages/plugin-name.pot
if git diff-files --shortstat plugin-folder/languages/plugin-name.pot | grep "1 insertion(+), 1 deletion(-)" &> /dev/null ; then
git checkout HEAD -- plugin-folder/languages/plugin-name.pot
exit 0
else
git add plugin-folder/languages/plugin-name.pot
fi
@gMagicScott Thanks for sharing this snippet. I will try to merge with deploy-plugin.sh
The check in deploy-plugin.sh#L150 is nice but will always evaluate to true as makepot.php will change a timestamp in the POT file on every call.
Some RegEx magic is needed again to revert the file if nothing except the timestamp
POT-Creation-Date: 2013-10-18 21:42:46+00:00\n"
has changed.I posted an issue and asked for a change of that behaviour at my preferred WP i18n tools variant: grappler/i18n#4 as this issue should eventually be mitigated at the source.