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: Greg Wooledge <wooledge@xxxxxxxxxxx>
Cc: Freeciv Developer <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Is it possible...
From: Stig Erik Sandoe <stig@xxxxxxxxx>
Date: Sun, 14 Nov 1999 20:42:52 +0100 (MET)

On Sun, 14 Nov 1999, Greg Wooledge wrote:

> But this is a more serious translation issue.  I'm not sure what the best
> way to avoid it would be.  And it's deeper than just "a" vs. "an" -- there
> are other problems.
[snip]
> 
> With that in mind, I've come up with these ideas:
> 
>   (1) In order to get good translations, you have to spit out large
>       strings, not small ones.  Ideally we want the translator to get
>       the whole sentence "You caught a Babylonian Spy attempting sabotage
>       in Paris!", or as much of this sentence as possible.
> 
>   (2) On the other hand, we don't want translators getting thousands of
>       permuations of similar sentences -- e.g., it would be a horrible
>       waste of time and disk space to force people to translate
>       "You caught a Babylonian Spy attempting sabotage in Paris!" and
>       "You caught a Babylonian Diplomat attempting sabotage in Paris!" and
>       "You caught a Babylonian Spy attempting sabotage in London!"....

[snip]
> It might be possible to find some middle ground -- or at least, I hope
> it's possible.  Perhaps if we could break up the sentence like this:
> 
>   "You caught %s attempting sabotage in %s!"
> 
> and then we could pass a nation/unit pair in the first string, and a city
> name in the second string.

Now you're on the right track imho. (see below)

> Would this be worthwhile, or a waste of time?  If it's worthwhile, how
> exactly do we go about getting the nation/unit strings into the potfile?
> (I can see how to generate the string-to-translate within the game code,
> but I don't see how they'd all get into the potfile so that they can be
> translated before runtime.)

The real problem is gettext; gettext is a simple hack for a
complex problem and doesn't scale. If good translations are wanted,
gettext is not the way to go because all it does is naive
replacing of strings. What you say is however right, one needs
functions which take different arguments and return some object
containing the wanted translation based on the arguments. The
functions will need grammar-knowledge and processing-capabilities
which gettext never can provide. Ie. one calls a function with
proper arguments and get back a generated string. 

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). 

------------------------------------------------------------------
Stig Erik Sandoe     stig@xxxxxxxxx    http://www.ii.uib.no/~stig/



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