Module talk:Person height
This is the talk page for discussing improvements to the Person height module. |
|
How can we localize cm, m, ft labels for other wikis?
Is it possible to do that at this stage or should there be a new line of code introduced?--Épine (talk) 16:07, 21 July 2021 (UTC)
Default preference should be conversion to metres, not centimetres
It seems like if the prefer_m
argument is not set, the module defaults all feet/inches conversions to centimetres. This should be changed to metres instead, which is the more common and international unit of measurement (e.g., in the Olympics, the UN, other international bodies, and in things like BMI calculations, etc.). Getsnoopy (talk) 18:57, 29 August 2021 (UTC)
Forcing number of metric digits
@Frietjes: Would it be possible to add an option to force a certain number of digits when using metres? When height is given in feet and inches, the module always outputs 3 digits, e.g. {{#invoke:person height|main|5 ft 7 in}}
outputs "5 ft 7 in (170 cm)". However, when the height is given in metres but with only 1 or 2 digits, the template will output the number as given. In addition, when using |enforce=m
, if the height is supplied in centimetres, any trailing zeroes will be cut off after converting to metres. Would it be possible in such cases to have a way to force three digits to be shown for metres? I have included a table below as a summary. Thanks, S.A. Julio (talk) 08:42, 4 May 2023 (UTC)
- S.A. Julio, I have added an optional
|adj=
to the sandbox which can be|adj=ri0, ri1, ri2, ri3
. since this is just a wrapper for {{convert}} all this does is pass the|adj=
to the call to {{convert}}. this means the|adj=ri2
is with respect to the input to the convert template, not the input to the module. I don't know if this is going to cause any unexpected results in other cases. another option would be have a more restricted input syntax that only applies to some cases (e.g.,|ri=cm
to round input to the nearest centimeter). what do you think we should do? Frietjes (talk) 14:55, 4 May 2023 (UTC)
Input | Current output | Desired output | Sandbox | Sandbox (adj=ri2) |
---|---|---|---|---|
2 m | 2 m (6 ft 7 in) | 2.00 m (6 ft 7 in) | 2 m (6 ft 7 in) | 2 m (6 ft 7 in) |
1.8 m | 1.8 m (5 ft 11 in) | 1.80 m (5 ft 11 in) | 1.8 m (5 ft 11 in) | 1.8 m (5 ft 11 in) |
1.803 m | 1.803 m (5 ft 11 in) | 1.80 m (5 ft 11 in) | 1.803 m (5 ft 11 in) | 1.803 m (5 ft 11 in) |
1.809 m | 1.809 m (5 ft 11 in) | 1.81 m (5 ft 11 in) | 1.809 m (5 ft 11 in) | 1.809 m (5 ft 11 in) |
200 cm | 2 m (6 ft 7 in) | 2.00 m (6 ft 7 in) | 2.00 m (6 ft 7 in) | 2.00 m (6 ft 7 in) |
180 cm | 1.8 m (5 ft 11 in) | 1.80 m (5 ft 11 in) | 1.80 m (5 ft 11 in) | 1.80 m (5 ft 11 in) |
180.3 cm | 1.803 m (5 ft 11 in) | 1.80 m (5 ft 11 in) | 1.803 m (5 ft 11 in) | 1.803 m (5 ft 11 in) |
180.9 cm | 1.809 m (5 ft 11 in) | 1.81 m (5 ft 11 in) | 1.809 m (5 ft 11 in) | 1.809 m (5 ft 11 in) |