Add a translatable string which is already translated but has a different meaning now

Hi all,

I want to add the following code in my application:

    // Translators: Translate 'Copy' as a noun here
    char *copyString = _("Copy");

This string is later on used for creating a new filename if the desired file name is already existing.

When locally installing the application and running it with a German locale, I see that the word “Copy” is already translated, but in an incorrect manner here: It is translated as a verb and not as a noun. The already existing po-file entry is:

msgid "Copy"
msgstr "Kopieren"

Apart from the comment ahead of the the actual line of code (in my example above), how I can make the Gnome l10n teams aware of the issue that the possibly already translated string is not the correct one for the new source code?

Hi, you need to use the C_() macro, which itself uses g_dpgettext(). Here’s the example usage from the documentation:

label1 = C_("Navigation", "Back");
label2 = C_("Body part", "Back");

Basically you pass whatever explanation (“context”) you need as the second parameter.

I’m not sure, but I assume hope translation tools will display the provided context.

1 Like

Great, thank you, Michael. I will use it like this:

auto copyString = C_("Filename suffix", "Copy");

When testing locally, the word is not translated anymore, so I’m guessing that the translators will take a note about the new word to be translated.

Yes, it will indeed require updated translations.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.