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

extract overwrites existing template, and update comments unused #1086

Open
maxktz opened this issue May 18, 2024 · 2 comments
Open

extract overwrites existing template, and update comments unused #1086

maxktz opened this issue May 18, 2024 · 2 comments

Comments

@maxktz
Copy link

maxktz commented May 18, 2024

when i use pybabel extract or pybabel update there is no way to not remove existing translations, unused translations that existed in .pot or .po are being removed or commented.

Please add flag to save them while using this commands.

@akx
Copy link
Member

akx commented Jul 17, 2024

extract never reads existing files – it just overwrites the given output file.

Have you tried --previous for pybabel update? Does it do what you need?

@maxktz
Copy link
Author

maxktz commented Aug 12, 2024

--previous

About --previous, yes I guess it's what I need, it's just wasn't clear for me, what it really does. I would call it --keep-previous, or --keep-existing, something like that.

About --extract,
I was wrong a little bit, that extract creates template, I thought it updates template file.
But the problem is that it overwrites existing template.

There are some msgids that extract can't see in files, right?
So I add them to template manually.

I want extract to have option to just update template file by extracted msgids, not overwrite, got it?

I have achieved that behavior by doing this (in case someone need it):

I just store manually added msgids in mymessages.pot template

Then run this commands:

# extract to messages.pot template
pybabel extract -F babel.cfg -o messages.pot .

# merge mymessages template to messages.pot
cat mymessages.pot >> messages.pot

# then update catalogs
pybabel update -i messages.pot -d ./translations

@maxktz maxktz changed the title Please add flag to DO NOT remove/comment existing translations while updating or extracting extract overwrites existing template. And update comments unused Aug 12, 2024
@maxktz maxktz changed the title extract overwrites existing template. And update comments unused extract overwrites existing template, and update comments unused Aug 12, 2024
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

2 participants