Template:Size: Difference between revisions
More actions
I was confused, that's what it needs to be |
mNo edit summary |
||
| Line 1: | Line 1: | ||
{{#switch: {{{1|cm}}} | {{#switch: {{{1|cm}}} | ||
| cm = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} cm ({{formatnum|{{#expr:( {{{2|0}}} * 0.39370) round {{{4|2}}}}}| | | cm = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} cm ({{formatnum|{{#expr:( {{{2|0}}} * 0.39370) round {{{4|2}}}}}|prec={{{4|2}}} }} × {{formatnum|{{#expr:( {{{3|0}}} * 0.3937) round {{{4|2}}} }}|prec={{{4|2}}} }} in) | ||
| m = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} m ({{formatnum|{{#expr:( {{{2|0}}} * 1.09360) round {{{4|2}}}}}| | | m = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} m ({{formatnum|{{#expr:( {{{2|0}}} * 1.09360) round {{{4|2}}}}}|prec={{{4|2}}} }} × {{formatnum|{{#expr:( {{{3|0}}} * 1.0936) round {{{4|2}}} }}|prec={{{4|2}}} }} yd) | ||
| km = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} km ({{formatnum|{{#expr:( {{{2|0}}} * 0.62138) round {{{4|2}}}}}| | | km = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} km ({{formatnum|{{#expr:( {{{2|0}}} * 0.62138) round {{{4|2}}}}}|prec={{{4|2}}} }} × {{formatnum|{{#expr:( {{{3|0}}} * 0.62138) round {{{4|2}}}}}|prec={{{4|2}}} }} mi) | ||
| in = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} in ({{formatnum|{{#expr:( {{{2|0}}} * 2.54) round {{{4|2}}}}}| | | in = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} in ({{formatnum|{{#expr:( {{{2|0}}} * 2.54) round {{{4|2}}}}}|prec={{{4|2}}} }} × {{formatnum|{{#expr:( {{{3|0}}} * 2.54) round {{{4|2}}}}} |prec={{{4|2}}} }} cm) | ||
| ft = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} ft ({{formatnum|{{#expr:( {{{2|0}}} * 0.3048) round {{{4|2}}}}}| | | ft = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} ft ({{formatnum|{{#expr:( {{{2|0}}} * 0.3048) round {{{4|2}}}}}|prec={{{4|2}}} }} × {{formatnum|{{#expr:( {{{3|0}}} * 0.3048) round {{{4|2}}}}} |prec={{{4|2}}} }} m) | ||
| yd = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} yd ({{formatnum|{{#expr:( {{{2|0}}} * 0.9144) round {{{4|2}}}}}| | | yd = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} yd ({{formatnum|{{#expr:( {{{2|0}}} * 0.9144) round {{{4|2}}}}}|prec={{{4|2}}} }} × {{formatnum|{{#expr:( {{{3|0}}} * 0.9144) round {{{4|2}}}}} |prec={{{4|2}}} }}} m) | ||
| mi = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} mi ({{formatnum|{{#expr:( {{{2|0}}} * 1.60934) round {{{4|2}}}}}| | | mi = {{formatnum|{{{2|0}}}}} × {{formatnum|{{{3|0}}}}} mi ({{formatnum|{{#expr:( {{{2|0}}} * 1.60934) round {{{4|2}}}}}|prec={{{4|2}}} }} × {{formatnum|{{#expr:( {{{3|0}}} * 1.60934) round {{{4|2}}}}}|prec={{{4|2}}} }} km) | ||
| #default=<br>'''Template:Size''' - unknown option 1={{{1|}}}, try cm/in/ft/m/km/mi...[[Category:Pages with invalid Template:Size code]] | | #default=<br>'''Template:Size''' - unknown option 1={{{1|}}}, try cm/in/ft/m/km/mi...[[Category:Pages with invalid Template:Size code]] | ||
}}<noinclude> | }}<noinclude> | ||
Revision as of 18:04, 22 September 2009
Template:Formatnum × Template:Formatnum cm (Template:Formatnum × Template:Formatnum in)
Displays a 1D (length), 2D (width × height) or 3D (width × height × depth) size, formatted according to localized format. For example if user language is English then measurements will be shown in both centimeters and inches, if user language is German than only metric units will be shown. This template is mainly used in the "Dimensions" field of an {{Artwork}} template.
Usage
{{Size |unit= |height= |width= }}
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
unit1 | Unit of input (must be one of: cm, m, mm, km, in, ft, yd, mi). | cm | required | |
height | height (with word "height" displayed) | empty | optional | |
width | width (with word "width" displayed) | empty | optional | |
length | length (with word "length" displayed) | empty | optional | |
depth | depth (with word "depth" displayed) | empty | optional | |
diameter | diameter (with word "diameter" displayed) | empty | optional | |
thickness | thickness (with word "thickness" displayed) | empty | optional | |
prec | Conversion precision (optional number of decimal digits). | 1 (2 for mm to inches) | optional | |
lang | language code (only needs to be provided if the language shall be fixed and independant from the user's preferences) | value of {{int:Lang}} | optional | |
1 | Alternative name for "unit". Unit of input (must be one of: cm, m, mm, km, in, ft, yd, mi). Deprecated. | cm | deprecated | |
2 | First dimension measured. Deprecated. | empty | deprecated | |
3 | A second dimension measured. Deprecated. | empty | deprecated | |
4 | A third dimension measured. Deprecated. | empty | deprecated | |
Additional information
The template is intended to be used in the following namespaces: the File namespace
The template is intended to be used by the following user groups: no user group specified
Relies on:
Module:Size
See also
Localization
To add your language to the list of languages supported by this template, please edit the template and add a row to the "{{LangSwitch|}}" construct. It takes the form "|xx= Your translation " (xx being the code of your language)
All unit translations are in Module:I18n/units.
Examples
| Code | Output | Notes |
|---|---|---|
| {{Size|unit=m|height=10|width=20}} | Template:Formatnum × Template:Formatnum cm (Template:Formatnum × Template:Formatnum in) | Use of name parameters |
| {{Size|unit=mi|width=10|height=20|depth=30}} | Template:Formatnum × Template:Formatnum cm (Template:Formatnum × Template:Formatnum in) | Use of name parameters |
| {{Size|cm|12.1234|98.1234|prec=1}} | Template:Formatnum × Template:Formatnum cm (Template:Formatnum × Template:Formatnum in) | Use of "prec" parameter |
| {{Size|in|12.12|98.12|lang=fr}} | Template:Formatnum × Template:Formatnum in (Template:Formatnum × Template:Formatnum cm) | Use of "lang" parameter |
| {{Size|cm|123}} | Template:Formatnum × Template:Formatnum cm (Template:Formatnum × Template:Formatnum in) | 1D version |
| {{Size|in|123|456}} | Template:Formatnum × Template:Formatnum in (Template:Formatnum × Template:Formatnum cm) | 2D version |
| {{Size|ft|123|456|789}} | Template:Formatnum × Template:Formatnum ft (Template:Formatnum × Template:Formatnum m) | 3D version |
Displays a size, formatted according to localised format.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| lang | lang | language code
| String | optional |
| unit | unit | Unit of input
| String | required |
| height | height | no description | Number | optional |
| width | width | no description | Number | optional |
| length | length | no description | Number | optional |
| depth | depth | no description | Number | optional |
| diameter | diameter | no description | Number | optional |
| thickness | thickness | no description | Number | optional |
| prec | prec | Conversion precision (optional number of decimal digits)
| Unknown | optional |