0

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.

DevelJoe
  • 856
  • 1
  • 10
  • 24

1 Answers1

0

msginit does not behave in the way you describe. If your .po file contains msgstr entries you have created it in another way. The documentation that you refer to also does not say that msginit pre-populates msgstr entries except for the meta information. The meta information - sometimes called the po-headers - is the msgstr for the msgid '""' (the empty string) but that is not your problem here.

Furthermore, the msginit and msgmerge commands have totally different purposes. You use msginit to create a new and empty translation file for a new language that you support. The msgmerge command is used to update an existing .po file with new translatable strings from a .pot file, a po template file.

Guido Flohr
  • 1,871
  • 15
  • 28