Le 17/01/14 09:58, Petr Bena a écrit :
> There are many articles on wikipedia that contain different units.
> Some use cm, that are common in europe, other use inches that are more
> widely used in US, same with other unit types.
> 
> I think it would be cool if an extension was created which would allow
> everyone to specify what units they prefer, and the values in articles
> would be converted automatically based on preference.
> 
> For example you would say the object has width of {{unit|cm=20}} and
> people who prefer cm would see 20 cm in article text, but people who
> prefer inches would see 7.87 inch. This could be even based on
> geolocation for IP users

Hello,

I like the idea.  One thing to take in account is that the unit
conversion should be done on the client side to avoid fragmentation of
the parser cache.

A possibility would be for the template to output BOTH metrics and
imperial units, then use JS/CSS to hide the irrelevant one.  Hence
{{unit|cm=20}} would generate something like:

 <span class="mw-unitsystem-imperial">7,874 inches</span>
 <span class="mw-unitsystem-metric">20 cm</span>

Then using user preference to hide one of the class.


-- 
Antoine "hashar" Musso


_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to