Last modified: 2007-11-02 11:32:11 UTC
A Type page can list multiple synonyms for each "converts to" unit. A property can then say it wants to display any synonym for a unit, e.g. [[Display units::",centimetres]] instead of in, cm.
But in 1.0 the property's value in the factbox will use the first unit for each kind of unit from the datatype's Type: page, not the synonym you specify. So you see
10.4 in (26.416 cm)
instead of the
10.4 " (26.416 centimetres)
This is a regression from 0.7 (hence I'm marking this bug high priority); the factbox in 0.7 displays attribute values using whatever synonym for a unit you specify.
Similarly, the tooltip in the main text that displays the conversion to alternate units also uses the first unit. You see 26.416 cm in the tooltip, not the "26.416 centimetres" you requested. This also is a regression from 0.7
Similarly, the property page's list of values also uses the first unit, not the synonym you specify. This is not a regression, since in 0.7 the list of values on the property page ignored preferred units altogether.
Created attachment 4278 [details]
This patch fixes the factbox display and tooltip display to use the unit synonyms requested, but breaks the list of properties on the Property page ;-(
In SMW_DV_Linear.php's initDisplayData, each unit from SMW_SP_DISPLAY_UNITS is replaced with the canonical unit in m_unitids to come up with m_displayunits. But the code needs to remember the synonym(s) that the property wants. And then elsewhere the code needs to determine the canonical unit to get conversion factors, but not overwrite $unit with it
Created attachment 4279 [details]
This patch seems to work on individual pages and the property list. I'm not sure if it makes other cases (no preferred units, etc.) better or worse. Hope you find it useful.