Complete.Org: Mailing Lists: Archives: freeciv-dev: November 1999:
[Freeciv-Dev] Re: Is it possible...
Home

[Freeciv-Dev] Re: Is it possible...

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: stig@xxxxxxxxx
Cc: wooledge@xxxxxxxxxxx, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Is it possible...
From: Stan Shebs <shebs@xxxxxxxxxx>
Date: Sun, 14 Nov 1999 12:58:28 -0800

   Date: Sun, 14 Nov 1999 20:42:52 +0100 (MET)
   From: Stig Erik Sandoe <stig@xxxxxxxxx>

   [...] E.g go from 
   "Game: A%s %s %s was eliminated while infiltrating %s."

   to something like:

   translate("Game: %s %s eliminated while infiltrating %s."
             nationality and unit-type, 
             'to be' past sense,
             city);

   This allows the code to have text in it (to make it readable) which
   can be used for hash-lookups, while allowing the
   translation-function to reorder as wanted and have actual arguments
   to check out when translating. (To reduce speed-overhead the
   translation can probably be memoised)

   Replacing the simple gettext hack with a proper solution, probably
   based on a simple language to implement the functionality that is
   needed will take some work but will probably make the language
   support better, even for (american) english (a/an, was/were, plural
   forms of words). 

Xconq puts a bunch of text generation, such as the algorithm for
making an ordinal number string ("1st") out of a number, into a
special file of C code.  The strategy is untested, however, as no one
has yet mustered the energy to write one of these for a second
language.

Other text uses a technique borrowed from the Mac, which uses format
strings with *positional* directives, so the format string says "^0
attacks ^1", where ^0 becomes the first argument to the formatting
function, and ^1 becomes the second.  One could expand on the idea
with additional format specifiers, for instance something like
"^p0 attack^ga0 ^1" to indicate that ^0 is a plural, and to attach
an ending of the appropriate gender, in active voice, to the verb.

It's also worth considering whether you want to get tangled up with
that degree of generality, and think about simplifying the textual
component so the translation problems become less formidable.  Xconq
has gone the route of extreme generality, for good reasons, but as a
result, only a few people have the talent and energy to work on its
code, and improvements come slower than they might have otherwise.

                                                                Stan





[Prev in Thread] Current Thread [Next in Thread]