Open maxktz opened 6 months ago
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?
--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
when i use
pybabel extract
orpybabel 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.