Don't use too short messages

If too short translatable strings are used, context may become a problem, as the same short word or sentence can mean different things and need different translations in different places. As previously explained, the po format is a simple hash table format, which means that identical source strings always only get one entry and only one translation. Thus, the source strings must be well designed and try to avoid situations where them being too short causes ambiguity.

There are some new suggested solutions for introducing routines for handling special context markers that can be used by the developer in translatable messages, when there's an actual need to differentiate between English strings that can mean different things in different places in the application. In practice, just a little more verbosity in the messages to differentiate them can often suffice for solving the problem.

Perhaps the most illustrative example of a case where it went wrong with too short messages was when developer of a calendar application wanted to mark the beginning character of the name of each weekday for translation. What he did was something like this:

   char monday_char    = N_("M");
   char tuesday_char   = N_("T");
   char wednesday_char = N_("W");
   char thursday_char  = N_("T");
   char friday_char    = N_("F");
   char saturday_char  = N_("S");
   char sunday_char    = N_("S");

Obviously, since each unique string can only be translated once, this example would never be correctly translatable in any other language where the beginning characters of the Tuesday and Thursday pair, and the Saturday and Sunday pair, would not be the same. A better solution would be:

   /* Translators: These characters should be the beginning characters of
      the weekday names, Monday to Sunday. */
   char weekday_chars[] = N_("MTWTFSS");

This string would be unique, and with the appropriate translator comment also correctly translatable by translators.

It's important to keep in mind though that not only single-character strings may be affected by these problems. Many common English nouns and verbs are often ambigious, and when used in different contexts in the same application these problems can arise. below is a short example of words in English with duplicate meanings, that correspond to several different words in other languages.

Word

First meaning

Second meaning

Key

Button on a keyboard

Entry in a registry (GConf)

File

A file (noun)

To file (verb)

Forward

Direction

The action of forwarding an e-mail (verb)

Control

(noun)

(verb)

TranslationProject/DevGuidelines/Don't use too short messages (last edited 2010-06-25 11:39:17 by TobiasMueller)