URL:
  <http://gna.org/patch/?1080>

                 Summary: plural forms support in [set_variable]
                 Project: Battle for Wesnoth
            Submitted by: noyga
            Submitted on: lundi 30.06.2008 à 01:47
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: noyga
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

I post this patch for comments.

The goal is to some kind of ngettext() equivalent in WML.
In short, ngettext() is a function that fetch the right plural form according
to the number (in english there is two forms but other languages like arabic
have 6).
It isn't done at the preprocessor level since you typically want the number
to take in account to be a WML variable.
The translation is done inside a WML variable with a new [set_variable]
operation, so you can use it inside any EventWML tag.

Here is the syntax:
[set_variable]
   name=variable_name
   [_plural_form]
      singular="A singular string"
      plural="A plural string"
      number=$num
   [/plural_form]
[/set_variable]

It fetches the right plural form translation according to the number and
store it in the variable (using current textdomain).

This patch also have side effects :
- Names starting with a _ are no longer allowed (preprocessor symbols, tags
and keys). The patch fixes the only file that use this.
- Introduce a new form for tags : "[_tag]".
  This is equivalent to "[tag]" except it also autostore a textdomain= key
with the name of the texdomain on the tag opening.
Well it's a hackish way to store somewhere the texdomain value in  some
configs object without cluttering all config object with uneeded data.
Maybe someone will find a better idea.

TODO :
- strip the debugging messages
- make sure singular= & plural= are uninterpretted values
- implement what is needed



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: lundi 30.06.2008 à 01:47  Name: set_variable_plurals.patch  Size: 4 ko
  By: noyga
first patch
<http://gna.org/patch/download.php?file_id=4502>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?1080>

_______________________________________________
  Message posté via/par Gna!
  http://gna.org/


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

Reply via email to