Open FabianKielmann opened 1 year ago
Curious: What‘s a use case where the po file doesn‘t have that header but the pot file does? How are you generating the po file?
In our case, we just create an empty one.
As far as I know there is no default way of creating a .po file, right? So the first file we ever create (for a plugin for example) would be just an empty .po file which will then get updates from the .pot file that we generate via wp i18n make-json
.
As far as I know there is no default way of creating a .po file, right?
You could just copy yourcatalog.pot
to yournewpofile.po
and you have one :-)
Afterwards, whenever the .pot
file is updated, that's when you'd want to use the update-po
command.
Bug Report
Describe the current, buggy behavior
When creating a pot file from your wordpress files and then use
wp i18n update-po
to update your .po files: In case your .po file is empty, the update-process in general works, but the X-Domain header present in the .pot file will not be included.Describe how other contributors can replicate this bug
wp i18n make-pot
and make sure it added an X-Domain header containing your text-domainwp i18n update-po
Describe what you would expect as the correct outcome
I would expect the X-Domain header to be present in the updated .po file in case that the .pot file included it.
Let us know what environment you are running this on
Provide a possible solution
I took a look inside the code and found that the update-po command may use a "wrong" strategy or might just not tell mergewith how to handle the headers:
https://github.com/wp-cli/i18n-command/blob/main/src/UpdatePoCommand.php#L71