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

Option to skip POT-Creation-Date #725

Open
Dreamsorcerer opened this issue Aug 6, 2020 · 12 comments
Open

Option to skip POT-Creation-Date #725

Dreamsorcerer opened this issue Aug 6, 2020 · 12 comments

Comments

@Dreamsorcerer
Copy link

Dreamsorcerer commented Aug 6, 2020

Could we get an option to skip adding/updating the POT-Creation-Date header when running pybabel extract?

Use case is that we want a pre-commit hook that updates the translations, to ensure our translations are always in sync with the code base. But, because it changes this header every time, it results in a merge conflict with every single branch.

@cburmeister
Copy link

I would love this!

We've got a GitHub Action step that runs pybabel extract on every push to master that opens a Pull Request to update the message catalog. This option would allow us to skip creating Pull Requests that only contain changes to the POT-Creation-Date (or any other header changes like Generated-By, etc).

@Dreamsorcerer
Copy link
Author

We ended up adding a post-process step to strip out this line (and a couple more bespoke things).
So we have a script which basically runs the extract function, then runs some others functions which post-process the files. Given that we've been using it since I opened this issue with little issues, it seems to be pretty stable.

@cburmeister
Copy link

@Dreamsorcerer would you mind sharing some of that if possible? I started writing some bash to do this but it got unwieldily fairly quickly 😅

@Dreamsorcerer
Copy link
Author

Dreamsorcerer commented Apr 30, 2021

Slightly modified, but this should work (if you change project_path to the correct directory).
https://gist.github.com/Dreamsorcerer/9355fd2a308121589d7c2fa5ffaa3e8a

We ended up using the extract function in a pre-commit hook to ensure that translations were always in-sync with the code.

@cburmeister
Copy link

@Dreamsorcerer thank you!

@emibcn
Copy link

emibcn commented Feb 15, 2023

This feature would be very useful. Is there any updates on it?

@emibcn
Copy link

emibcn commented Feb 15, 2023

This feature can be to keep the creation date when updating, change it only on creation.

@akx
Copy link
Member

akx commented Feb 17, 2023

PRs are very much welcome :)

@joeportela
Copy link
Contributor

@akx Any interest in my PR? #999

@emibcn
Copy link

emibcn commented Sep 15, 2023

@akx
When will this be published into a new release?

@joeportela
Copy link
Contributor

@akx When will this be published into a new release?

This just got released in 2.13.0!

@emibcn
Copy link

emibcn commented Oct 18, 2023

@joeportela @akx
I have just tested the PO update functionality using the new option --ignore-pot-creation-date and it looks good (no creation date differences):

image

What I am missing now is something similar for the POT extract functionality:

image

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

5 participants