Add comments for messages extracted from .desktop files

Bug #410972 reported by Luca Ferretti on 2009-08-09
24
This bug affects 2 people
Affects Status Importance Assigned to Milestone
intltool
Wishlist
Unassigned

Bug Description

For translators' sake, could be interesting add comments explaing the .desktop key associated with message. I don't think this can be managed adding comments in .desktop file, like currently occurs in .c sources and similar.

Example

.desktop file contains

  _Name=Web Browser
  _Description=Browse the web

Related messages in .po file could appear like

  # Translators: this message will be used as Name
  msgid "Web Browser"
  msgstr ""

  # Translators: this message will be used as Description
  msgid "Browse the web"
  msgstr ""

I agree and I propose this is done for other files as well. GtkBuilder examples: "This is a button label", "This is an action tooltip" et cetera.

Sven Neumann (sven-gimp) wrote :

No need to start each comment with "Translators:" though.

xml2po already does that in a succint way:

#. When image changes, this message will be marked fuzzy or untranslated for you.
#. It doesn't matter what you translate it to: it's not used at all.
#: C/accerciser.xml:461(None)
msgid "@@image: 'figures/script_recorder.png'; md5=a15027c852c58df789886f6aadf0130c"
msgstr ""

#: C/accerciser.xml:24(title)
msgid "<application>Accerciser</application> Manual v0.2.0"
msgstr ""

#: C/accerciser.xml:27(year)
msgid "2006"
msgstr ""

Notice that in a specific situation a more verbose comment was added. This could apply also for strftime-formated messages, or messages with placeholders in general, as well as messages with old-style or new-style context.

I guess we can reuse the format xml2po uses in the source reference where it puts tag in parenthesis. I wouldn't like to add a long comment, but I would like to support comments added by maintainers to .desktop.in file.

Changed in intltool:
status: New → Triaged
importance: Undecided → Wishlist

Any progress?

Colomban Wendling (banw) wrote :

FWIW as of http://bazaar.launchpad.net/~intltool/intltool/trunk/revision/601 (way old) one can already at least put custom comments in .desktop files that will be visible by translators.

This said, yeah it could come in handy to show the key if no other comment was specified, and it'd be easy enough with an else around those lines:

sub type_ini {
    ### For generic translatable desktop files ###
    while ($input =~ /^(#(.+)\n)?^_([A-Za-z0-9\-]+)\s*=\s*(.*)$/mg) {
        if (defined($2)) {
            $comments{$4} = $2;
        } else {
            $comments{$4} = "key '$3'"
        }
        add_message($4);
    }
}

(e.g. capture the key in the regex, and use it as comment if none is provided)

Mingye Wang (artoria2e5) wrote :

The current regex only matches a single line of comment above the key, which lead to workarounds like https://git.gnome.org/browse/gnome-control-center/commit/?id=5c10ce45b8f2902e71a36649b9d0a31ccff6dc0f and very long lines in source text. Will you change it to match multiple lines?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers