Re: "New" problems in Evolution

Christian Rose <> writes:

> We should probably file a bug about this, as this is a fundamental
> design problem in Evolution that affects every single language that has
> genders.

Just tell them to read the gettext manual, section "How to use `gettext'
in GUI programs" ;) Extract:

-=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-

As as example consider the following fictional situation.  A GUI program
has a menu bar with the following entries:

     | File       | Printer    |                                      |
     | Open     | | Select   |
     | New      | | Open     |
     +----------+ | Connect  |

   To have the strings `File', `Printer', `Open', `New', `Select', and
`Connect' translated there has to be at some point in the code a call
to a function of the `gettext' family.  But in two places the string
passed into the function would be `Open'.  The translations might not
be the same and therefore we are in the dilemma described above.

   One solution to this problem is to artificially enlengthen the
strings to make them unambiguous.  But what would the program do if no
translation is available?  The enlengthened string is not what should be
printed.  So we should use a little bit modified version of the

   To enlengthen the strings a uniform method should be used.  E.g., in
the example above the strings could be chosen as


   Now all the strings are different and if now instead of `gettext'
the following little wrapper function is used, everything works just

       char *
       sgettext (const char *msgid)
         char *msgval = gettext (msgid);
         if (msgval == msgid)
           msgval = strrchr (msgid, '|') + 1;
         return msgval;

   What this little function does is to recognize the case when no
translation is available.  This can be done very efficiently by a
pointer comparison since the return value is the input value.  If there
is no translation we know that the input string is in the format we used
for the Menu entries and therefore contains a `|' character.  We simply
search for the last occurrence of this character and return a pointer
to the character following it.  That's it!

-=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-

                                                         |      ,__o
                                                         |    _-\_<,                            |   (*)/'(*)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]