Follow-up Comment #8, bug #11811 (project wesnoth):

A general solution to this would be quite hard, I think. The first proposal
isn't flexible enough as stated, so that's out (although something similar to
it could be implemented more easily). The second proposal requires changes to
the WML parser, which I'm not presently confident in touching, and furthermore
runs into the problem that variables are not known at parse time.

However, I have gone ahead and implemented gettext plurals support into the
Lua API. The syntax is essentially the same as proposal 2, except for
differences stemming from it being Lua rather than WML. Furthermore, I have
used this new feature to fix the specific string that GunChleoc identified as
problematic in the [objectives] tag, though wmlxgettext has not yet been
updated to understand it. (I haven't fixed the HTTT case since a WML solution
is not yet implemented.)

The new API could in principle be used to implement a WML-based way to perform
plural lookup, perhaps like this:


# Assign a plural string to the result variable
[set_variable]
  variable=result
  [plural]
    domain=wesnoth
    # Not marked translatable, because otherwise wmlxgettext would interpret
them as singular translatable strings
    singular="a thing"
    plural="several things"
    count=$num_things
  [/plural]
[/variable]


However, this is a poor solution in my opinion, as it would be difficult to
make wmlxgettext recognize them (although perhaps it could be made viable with
a standard macro), and it also requires temporary variables for working with
plural strings (though maybe other tags could also support [plural] subtags).

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?11811>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to