Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On deploy POT will always change and be commited. #12

Open
wedi opened this issue Oct 19, 2013 · 4 comments
Open

On deploy POT will always change and be commited. #12

wedi opened this issue Oct 19, 2013 · 4 comments

Comments

@wedi
Copy link
Contributor

wedi commented Oct 19, 2013

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.

@sudar
Copy link
Owner

sudar commented Oct 20, 2013

Agreed. Let me see if I am able to come up with that magic RegEx :)

@grappler
Copy link

It would be great if you could contribute to i18n.

@gMagicScott
Copy link

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

@sudar
Copy link
Owner

sudar commented Dec 16, 2013

@gMagicScott Thanks for sharing this snippet. I will try to merge with deploy-plugin.sh

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

No branches or pull requests

4 participants