extra comments on top of po files

Hello,

While preparing to 4.3 translation, I have
noticed that PO files downloaded from Pootle
contain a comment like this as first line of file

#. extracted from cui/uiconfig/ui

These comments are gone if I save the PO file
with Poedit, for example. Aren't they against the
PO file format?

Is it safe to remove these comments from PO files?

Thanks,

Hi Baurzhan,

Hello,

While preparing to 4.3 translation, I have
noticed that PO files downloaded from Pootle
contain a comment like this as first line of file

#. extracted from cui/uiconfig/ui

it's the directory from which the file is extracted

These comments are gone if I save the PO file
with Poedit, for example. Aren't they against the
PO file format?

Poedit don't show the comment but it still should be in the po file if
you edit it with gedit for example.

Is it safe to remove these comments from PO files?

not sure, Cloph will have to confirm if it's only an indication or used
somewhere.

Cheers
Sophie

Hi Sophie, Baurzhan, *,

Hi Baurzhan,

While preparing to 4.3 translation, I have
noticed that PO files downloaded from Pootle
contain a comment like this as first line of file

#. extracted from cui/uiconfig/ui

This is not an invalid line, more specifically it is a "extracted
comment" in gnu-terminology:
https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html
"Comment lines starting with #. contain comments given by the
programmer, directed at the translator; these comments are called
extracted comments because the xgettext program extracts them from the
program's source code"

In general, every line that starts with # is a comment. Some comments
have special meaning, like the #, fuzzy marker, and others like #~ are
used by pootle internally (this flags obsolete strings, i.e. strings
that once needed to be translated, but are no longer used in the
current version.

These comments are gone if I save the PO file
with Poedit, for example. Aren't they against the
PO file format?

Poedit don't show the comment but it still should be in the po file if
you edit it with gedit for example.

Is it safe to remove these comments from PO files?

The first line shouldn't matter, but you should avoid throwing away
the other comments, as the other comment lines contain the context for
the string - so when you remove the comments, pootle (or other tools)
cannot tell what string the translation belongs to, esp. when the
english string is the same for both.

not sure, Cloph will have to confirm if it's only an indication or used
somewhere.

It isn't safe to remove all comments, and #. and #: style comments are
commonly used, so I would be surprised if poedit would throw them all
away.
That being said the one in the very first line is not critical, so no
need to worry if that gets lost.

But if the comments above the individual translation strings also are
stripped, then you should have a closer look at the program's settings
or use another one.

ciao
Christian

Hello Christian,

Thanks for explanations, I am aware of importance of the comments,
I was just curious about that specific, first-line comment,
as it does not belong to any entry in PO file, so it is thrown away by Poedit.

Cheers,