[gnumeric-list]Re: gnumeric: Note to translators



Dennis Bjorklund <db zigo dhs org> writes:

Maybe one needs another macro that takes the string to translate and a
group string used to put things together.

_#("Mean", "Math")

_#("Tan", "Math")

That's an interesting idea.  I'm inclined to believe that's the way to
go in the long run.  But read below.

But it's probably just as good and easier to just use the comments that
work today

/* Math */
_("Mean")

To just put strings together like in gnumeric is just making it harder to
translate.

Yes, that's ugly and has to go away ASAP -- if it doesn't go away I'll
have to go ;)  Note to Bruno (who now maintains the gettext collection);
gnumeric groups the strings this way:

#.
#. * Note to translators: in the following string and others like it,
#. * the "/" is a separator character that can be changed to anything
#. * if the translation needs the slash; just use, say, "|" instead.
#. *
#. * The items are bundled like this to increase translation context.
#.
#: src/analysis-tools.c:798
msgid ""
"/Mean/Standard Error/Median/Mode/Standard Deviation/Sample "
"Variance/Kurtosis/Skewness/Range/Minimum/Maximum/Sum/Count"
msgstr ""
"/Mittel/Standardfehler/Median/Modus/Standardabweichung/Beispielvarianz/Kurtos"
"is/Skewness/Bereich/Minimum/Maximum/Summe/Anzahl"

As you can see, I don't know the translation of some terms -- should I
mark the whole string as fuzzy?  =:-)

As an programmer, every time you introduce a string you need to annotate
it with some context. Just simple things like annotating menu options with
the comment "menu option" would be good.

Yes, but the problem is xgettext wants the comment just before the
_("...") string.  Sometimes it isn't possible to add a comment at this
place ("looks to ugly").

Other things I've had problems with is programs that use the same string
for menu labels as for toolbutton labels. If the english string is short
it works for them, but if the translation is long then the toolbutton
becomes big. If you translate to a abbrivation, then the toolbutton is
nice but the menu is ugly.

IIRC, others already answered this questions.  That's kind of a hacker
bug and has to be reported as such.  Hackers will enlarge (prefix) the
artificially so we can translate it differently:

    _("1|select")
    _("2|select")

The new gettext manual proposed to use sgettext:

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

     Menu|File
     Menu|Printer
     Menu|File|Open
     Menu|File|New
     Menu|Printer|Select
     Menu|Printer|Open
     Menu|Printer|Connect

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

       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!

   If one now consistently uses the enlengthened string form and
replaces the `gettext' calls with calls to `sgettext' (this is normally
limited to very few places in the GUI implementation) then it is
possible to produce a program which can be internationalized.
-=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-


-- 
work : ke suse de                          |                   ,__o
     : http://www.suse.de/~ke/             |                 _-\_<,
home : keichwa gmx net                     |                (*)/'(*)




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