Summary: Add optional separate "rule name" for ruleset
objects, allowing them to be renamed
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Thursday 10/21/10 at 01:47
                Category: general
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: jtn
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 



The current pattern for naming ruleset objects, struct name_translation,
doesn't really allow them to ever be renamed; the same string is presented to
the user as a (translatable) English string and used in contexts where a
persistent unique machine-readable name is needed (savegames).

This is currently getting in the way of making the default language really
en_US (bug #16667); fixing grammatical errors caused by singular/plural
inconsistency (bug #16903); and making specialists into first-class ruleset
objects with proper help (patch #2050).

Sketch of a proposal to fix this, to attract comment:
* Add a new entry 'rule_name' to struct name_translation, to contain the
unique persistent non-user-facing name.
* Initialise it by default to be the same as 'vernacular'; this avoids
changing lots of code and, more importantly, means that ruleset authors
aren't obliged to think of "rule names" for the majority of cases where the
English name is perfectly fine as a rule name.
* Add an optional entry "rule_name" to ruleset items such as units alongside
"name", which overrides the default behaviour. Most ruleset items won't need
to specify this, only where needed.
* I haven't thought of a reason why the rule name needs to go over the
network to the client yet; hopefully it can stay in the server. Otherwise
it'll need packet formats changing, of course.

Examples of use:
* To solve the "Harbour"/"Harbor" problem of bug #16667: for that building
only, in rulesets, change 'name = _("Harbour")' to 'name = _("Harbor")' /
'rule_name = "Harbour"', so that the default string (and key for
translations) is correct for en_US, but existing savegames which reference
"Harbour" continue to work.
* To solve specialists problems of patch #2050, change 'name = _("elvis")' to
'name = _("Entertainers")' / 'rule_name = "elvis"' for similar reasons.

The naïve implementation would increase memory usage a bit. It would be
possible to trade off execution time against this if desired.


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to