Make messages generic

This is also an aspect of the general principle "don't mark things for translation that shouldn't be translated". Whenever you include some name, be it a file name, directory name, procedure name or the like, don't make the translator have to "translate" it. First of all, it introduces an unnecessary danger of accidental "translation" or typos in the name, and secondly, a more generic approach really can save the translator some work. Some examples:

   g_printf (_("Your preferences were saved in the file $HOME/.fooconfig"));

The next time you should happen to change the file name or the location of the configuration file, each and everyone of the translations will need an update. That's not good design. A much better approach:

   g_printf (_("Your preferences were saved in the file %s"),
             "$HOME/.fooconfig");

A similar approach can also be used for debug output from function calls. Don't do messages like this:

   g_printf (_("input_gnomevfs: read error\n"));

Do them this way instead:

   g_printf (_("%s: read error\n"),
             "input_gnomevfs");

By this simple change the message hasn't just been stripped of the name that shouldn't be translated anyway. The message has also been made generic. Suddenly this exact message can be used on every function that needs to output the "read error" text, and the translator will only have to translate it once, and whenever a new function that needs to output the "read error" text is added, translations won't have to be updated.

TranslationProject/DevGuidelines/Make messages generic (last edited 2008-02-03 14:46:30 by anonymous)