By default, when generating a PO file using the msginit command of the gettext package according to their source, the
msgstr values are prepopulated with the corresponding msgid values, so you get sth like this in your PO file..:
#. Message for unknown errors
#: /Http/Response.php:367
msgid "An unknown error occurred."
msgstr "An unknown error occurred."
created with a command like this:
msginit --input=mydomain_source.pot \
--locale=fr_FR.UTF-8 \
--no-wrap \
--no-translator \
--output-file="mydomain-fr_FR.po"
The .pot file of course does not contain any msgstr values, and has been generated using the xgettext command.
The desired output should instead not hold any msgstr values:
#. Message for unknown errors
#: /Http/Response.php:367
msgid "An unknown error occurred."
msgstr ""
Is there a way to prevent this in gettext, or is this a bug? Or actually intended behaviour?? We're only having this problem with the msginit command, when using the msgmerge command of the gettext package, no default msgstr values get pasted.
msginitdoes not behave in the way you describe. If your.pofile containsmsgstrentries you have created it in another way. The documentation that you refer to also does not say thatmsginitpre-populatesmsgstrentries except for the meta information. The meta information - sometimes called the po-headers - is themsgstrfor themsgid'""' (the empty string) but that is not your problem here.Furthermore, the
msginitandmsgmergecommands have totally different purposes. You usemsginitto create a new and empty translation file for a new language that you support. Themsgmergecommand is used to update an existing.pofile with new translatable strings from a.potfile, a po template file.