Complete.Org: Mailing Lists: Archives: freeciv-i18n: August 2006:
[freeciv-i18n] Re: [Freeciv-Dev] (PR#19049) Problematic/buggy strings.
Home

[freeciv-i18n] Re: [Freeciv-Dev] (PR#19049) Problematic/buggy strings.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: bugs@xxxxxxxxxxx
Cc: freeciv-i18n@xxxxxxxxxxx
Subject: [freeciv-i18n] Re: [Freeciv-Dev] (PR#19049) Problematic/buggy strings.
From: Sini Ruohomaa <sini.ruohomaa@xxxxxx>
Date: Tue, 01 Aug 2006 13:36:06 +0300

Hi, Jason,

(Freeciv-i18n: cc'd for thine information and entertainment, as well as
keeping the list awake. ;))

Episode x in our series of "let's see how long mails we can generate" -
sorry 'bout that.

On Mon, 2006-07-31 at 10:57 -0700, Jason Dorje Short wrote:
> > #: client/text.c:176 client/gui-sdl/mapview.c:626
> > msgid " with "
> > 
> > This string needs a translator comment at the least, but it is also
> > buggy: sentences of any sort should not be split up like this, they
> > should be produced with e.g. "%s with %s" (and translator-commented) so
> > that we can move the with to be somewhere else as well if needed.
> 
> It is a problem.  Building sentences using code is quite problematic. 
> But the alternative is a switch statement with a potentially infinite 
> number of cases.  

The text.c code looks like this:
    impr_type_iterate(i) {
      if (is_improvement_visible(i) && city_got_building(pcity, i)) {
        /* TRANS: previous lines gave other information about the city. */
        if (has_improvements) {
          astr_add(&str, ", ");
        } else {
          astr_add(&str, _(" with "));
        }

        astr_add(&str, get_improvement_name(i));
        has_improvements = TRUE;
      }
    } impr_type_iterate_end;

>From a quick look, you're building a structure like, e.g.
"City: Helsinki (Finland(?), Friendly) with Aqueduct" or
"City: Helsinki (Finland(?), Friendly), Aqueduct". 
(not sure what the difference here is, but I'm not a Freeciv coder :))

The mapview.c bit apparently does stuff like "someting-something with
Barracks, Port, Airport, City Walls (Finland, Friendly)", doesn't seem
too different. 

Would gettext somehow break up if you store the first part (City ... )
which is translateable in a string variable (e.g. var1), then store the
get_improvement_name thing in another string variable (e.g. var2), then
let us translate
/* TRANS: This structure gives information about blahblah, looking e.g. 
   like "City: Helsinki ... (what I guessed above for ',') */
_("%s, %s"), var1, var2

and

/* TRANS: This structure gives information about blahblah, looking e.g. 
   like "City: Helsinki ... (what I guessed above for 'with') */
_("%s with %s"), var1, var2

and give them the two string variables as parameters? The way I see it,
we really only need the chance to juggle things around sensibly, like
sometimes I might want to add something after the last %s when 'with'
wants to be a postposition instead of a preposition. I've had a chance
to translate the initial string and the improvement name, after all. 

If you're building a list, I'm not sure if the recursion causes problems
with this approach, but "with" isn't a thing to put in the second-last
position of a list anyway.

If the comma-translation is problematic in the "%s, %s" format, please
use a translateable "?list_separator:, " (or however context is spelled,
I forget) everywhere you currently use an untranslateable ", ". That way
e.g. languages with no punctuation (Japanese, Chinese, if I'm not
mistaken) can kill the comma from their listings - uhm, actually, I
*assume* it's possible to somehow translate a string to be "" in
practice without gettext thinking it means the string is untranslated.
Maybe it works to translate it into "?list_separator:".

I'm not completely sure how right-to-left-written languages react to
this method of building listings, but taking a quick glance at the
Arabic translation, the translation text seems to flow left-to-right
judging by the positioning of punctuation and %ses (maybe the flipping
is done elsewhere?). So I guess having a translateable comma would be
sufficient, with no need for "%s, %s" to be translateable if it's
problematic.

> > --------------------------------------
> > #: client/helpdata.c:1310
> > #, c-format
> > msgid "* Each of your cities will avoid paying %d %s towards unit
> > upkeep.\n"
> %s is the output type, like 'shields'.  There are currently no different 
> forms of this.  I honestly don't know much about linguistics or 
> translation so I don't know if a different form is needed here.  In 
> particular, since there is no singular/plural/dual forms available it 
> isn't really possible to use PL_ here.
> 
> In most cases this won't matter since for the default ruleset I believe 
> %d is always 3.

Hmmm. So the ruleset generally is only 3, but is user-modifiable to
anything, while there's always only three options for the output type
(shields, trade, food)? You can use PL_ if you split it into "avoid
paying %d food", "avoid paying %d shields" and "avoid paying %d trade",
right?

...Or, actually, even better: if you make "%d shields", "%d trade" and
"%d food" (oh, and "%d gold", "%d luxury" and "%d science")
translateables in their own PL_'ed right, it might allow us to get their
translations right in even more places where they apply! Wheeee! :D 

Actually, it's hard to check from the pot alone how often these *would*
apply - I guess Freeciv might build untranslateable sentences that
should use those, but it often visibly rotates the structure to e.g.
"Gold: %d" which at least assumes no pluraling is needed - but it also
wouldn't be necessary anymore except in places where it's really
natural. And it seems more often the three-way splitting is done
instead, to produce strings like

#: client/gui-xaw/citydlg.c:1435
#, c-format
msgid ""
"\n"
"Total trade %d Trade/Year\n"
msgstr ""

(which, by the way, could use a PL even though it's identical for
Freeciv-English)

It's uncommon that I spot a pluralized form of any of the six
measurables, but a quick grep finds:

#: client/gui-mui/citydlg.c:1324
msgid "Shields"
msgstr ""

#: common/city.c:54 client/gui-gtk-2.0/repodlgs.c:935
#: client/gui-mui/citydlg.c:1600 client/gui-mui/repodlgs.c:667
#: client/gui-win32/repodlgs.c:692
msgid "Shield"
msgstr ""

- strange that a single "2 or more"-plural of Shield appears in a single
file.

> > ------------------------------------------------------------
> > 
> > #: client/helpdata.c:678
> > #, c-format
> > msgid "* Allows all players with knowledge of %s to build %s units.\n"
> > 
> > What can the latter %s be? These kinds of strings are in a few places in
> > the helpdata stuff, please add a translator comment to at least this
> > one.
> 
> In the default ruleset this will always come out as '* Allows all 
> players with knowledge of atomic power to build nuclear units.\n'.  I'll 
> add a TRANS comment.

Thanks! 

> > ------------------------------------------------------------
[Let's not have formatting translated, like in:]
> > #: client/helpdata.c:170
> > #, c-format
> > msgid ""
> > "Requires the %s government.\n"
> > "\n"
(...)
> That is a problem in a LOT of places.  The same issue crops up with 
> prefixes like the old 'Game: ' but also like '* ' from the previous 
> example you gave.  Fixing these isn't that easy though - I won't be 
> making major changes to translatable strings for the 2.1 release, since 
> that would break a lot of translations.  But we should try to clean all 
> these up for 2.2.

2.2 or trunk is fine by me! :)

> > ------------------------------------------------------------
[This string is something to be replaced with actual text later, no need to 
translate.] 
> > #: client/gui-gtk-2.0/gui_main.c:197 client/gui-gtk-2.0/gui_main.c:202
> > #: client/gui-gtk-2.0/gui_main.c:207 client/gui-gtk-2.0/gui_main.c:212
> > #: client/gui-gtk-2.0/gui_main.c:217 client/gui-gtk-2.0/gui_main.c:222
> > #: client/gui-gtk-2.0/gui_main.c:227 client/gui-gtk-2.0/gui_main.c:232
> > #: client/gui-gtk-2.0/gui_main.c:237 client/gui-gtk-2.0/gui_main.c:242
> > #: client/gui-gtk-2.0/gui_main.c:247 client/gui-gtk-2.0/gui_main.c:252
> > msgid "FIXME"
> > ------------------------------------------------------------
> > 
> > #: client/gui-gtk-2.0/gui_main.c:201
> > msgid "Notify Label"
> > 
> > All these labels are unclear. Could you add translator comments to
> > gui-gtk-2.0/gui_main around lines 196-241?
> 
> Same problem as above.  Notify Label is one of the FIXME options.  But I 
> don't know what it does so I can't write a full help message or a TRANS 
> comment.
> 
> > ------------------------------------------------------------
[We can't follow these kinds of inflictions, and why's %s not e.g.
"(the) Finnish"?]

> > #: server/diplhand.c:392
> > #, fuzzy, c-format
> > msgid "You receive %s's worldmap."
>
> I find it easiest just to add a sample text into the TRANS comment.  In 
> the above case this would probably be "You receive Giles's worldmap.", 
> since I assume it is the leader name not the nation name that is used. 
> Use of the leader name throughout is a major usability issue - but not 
> something that will be fixed for 2.1.0.

Nodnod, if it's fixed in a year for trunk I'll be just as happy - I 
just generally look at my translation when a release is imminent, since
there's no point for me to go translating strings outside "string
freeze" (even if it's only a pre-release slowdown in feature-adding
instead of a real freeze).

> > ------------------------------------------------------------
> > 
> > #: server/diplomats.c:714
> > #, c-format
> > msgid "You caught %s %s attempting to incite a revolt in %s!"
> > 
> > This is a very generic example of a sentence which will need to be
> > translated starting with %s %s for reasons of general Freeciv
> > untranslateability to a non-analythical language. In addition, %s is
> > e.g. "Finnish", which in Finnish is translated as
> > 'suomalaisten' (of-the-Finnish-people). I'm suspecting the sentence will
> > begin with a non-capital letter as a result. What can be done about it?
> > It's bad form to cap all genetives in Finnish.
> > 
> > The general problem of untranslateability is that a language like
> > Finnish would need separate translateable strings to e.g.
> > "your %s" (unit)
> > "object?%s" (as an object of a sentence, like you caught %s)
> > to make sentences really work.
> > 
> > In addition, all town names really need separate translations for "in %
> > s", "near %s" and "to %s". And town names are untranslateable to begin
> > with. But I'll have to write about this more after I consult the Gnome
> > Finnish team for more wisdom. Basically, the Finnish translation sounds
> > like a mechanized horror because all these need to be tweaked around:
> > "You caught the %s unit of %s attempting to incite a revolt in the town
> > of %s!" is an example of the more sensible adjustments I've made. It
> > causes me motivational problems to translate something that sounds so
> > horrible I wouldn't use it myself, but working with Freeciv seldom
> > enough is good for forgetting such misthoughts and getting some work
> > done instead. ;)
> 
> I don't see that anything can reasonably be done for this.

I don't have any bright ideas about it so far either, but judging by a
quick question round it might be something to take up with gettext folk
instead anyway - we got pluralization support that's personalized to how
many plurals you need, so we might eventually have infliction support in
gettext too. In either case it's a long-term project, but hey, I vividly
remember my amazement when plurals started working too. :)

Thanks for your quick reply to a big pile of subprojects!

--Sini




[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-i18n] Re: [Freeciv-Dev] (PR#19049) Problematic/buggy strings., Sini Ruohomaa <=