Opened 3 years ago

Last modified 3 months ago

#3972 new defect

Tooltips and loading screen tips should not hardcode the numbers but use sprintf

Reported by: elexis Owned by:
Priority: Must Have Milestone: Backlog
Component: Internationalization & Localization Keywords:
Cc: Patch:

Description (last modified by elexis)

#3904 is one of many examples of tooltips being wrong due to hardcoded numbers being present in translated strings, which are often not updated when the balancing is changed.

Besides being wrong often, it also adds pointless overhead when doing balancing or translations.

Instead it should access the template data directly and fill in the numbers using sprintf.

The loading screen tips can be found in binaries/data/mods/public/gui/text/tips/. Maybe these numbers could just be removed in the first place.

Change History (2)

comment:1 Changed 3 years ago by Teiresias

A general consideration: For tooltips, a reference to the template attributes is probably sufficient, as they are closely linked to the implementation of the tech/entity.

For the loading screen texts the situation seems more tricky, as they tend to describe a unit in detail, quoting

- The foremost Athenian politician of the 5th century BCE.

- Buildings construct faster within his range.

- Temples are cheaper while he lives.

This does not easily map to some template attribute. Approaches to validate such texts might include:

  • Attach a kind of constraint evaluator to the loading screen tips which examine the template definitions in detail (probably overkill)
  • Somehow link the tip file to the template it 'stems from'. If the template file(s) outdate the tip file, the tip is marked as questionable

Edit: Fixed typo

Last edited 3 years ago by Teiresias (previous) (diff)

comment:2 Changed 3 months ago by elexis

Description: modified (diff)

Number format convention changes as proposed in D1806 might be another use case for using sprintf to insert numbers into descriptions, if that's feasible.

IIRC we removed most but not all loading screen hardcoded numbers.

Loading screen tooltips already have a fixed format:

  • first line caption
  • other lines content

As of r22137, loading screen tooltips also assume one line per item. Phab:D1377 discusses XML and JSON as alternatives over txt. Adding sprintf support doesn't sound so far fetched.

Note: See TracTickets for help on using tickets.