Template:Size/doc: Difference between revisions
More actions
No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
|1stat=required | |1stat=required | ||
|2=2 | |2=2 | ||
|2d=Alternative name: | |2d=Alternative name: "width". Width (in the declared unit, with "." as decimal separator). | ||
|2def=0 | |2def=0 | ||
|2stat=required | |2stat=required | ||
|3=3 | |3=3 | ||
|3d=Alternative name: | |3d=Alternative name: "height". Height (in the declared unit, with "." as decimal separator). | ||
|3def=0 | |3def=0 | ||
|3stat=optional | |3stat=optional | ||
|4=4 | |4=4 | ||
|4d=Alternative name: | |4d=Alternative name: "depth". Depth (in the declared unit, with "." as decimal separator). | ||
|4def=0 | |4def=0 | ||
|4stat=optional | |4stat=optional | ||
| Line 62: | Line 62: | ||
| 3D version | | 3D version | ||
|- | |- | ||
| <nowiki>{{Size|unit= | | <nowiki>{{Size|unit=m|height=10|width=20}}</nowiki> | ||
| {{Size|unit= | | {{Size|unit=m|height=10|width=20}} | ||
| Use of name parameters | | Use of name parameters | ||
|- | |- | ||
| Line 70: | Line 70: | ||
| Use of name parameters | | Use of name parameters | ||
|- | |- | ||
| <nowiki>{{Size| | | <nowiki>{{Size|cm|12.1234|98.1234|prec=1}}</nowiki> | ||
| {{Size| | | {{Size|cm|12.1234|98.1234|prec=1}} | ||
| Use of "prec" parameter | | Use of "prec" parameter | ||
|- | |- | ||
| <nowiki>{{Size| | | <nowiki>{{Size|in|12.12|98.12|lang=fr}}</nowiki> | ||
| {{Size| | | {{Size|in|12.12|98.12|lang=fr}} | ||
| Use of "lang" parameter | | Use of "lang" parameter | ||
|- | |- | ||
Revision as of 19:33, 21 April 2010
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 than measurements will be shown in both centimeters and inches, if user language is German than only metric units will be shown. Template mostly Used in the "Dimensions" field of a Painting template.
Usage
{{Size |1= |2= |3= |4= |prec= |lang= }}
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
1 | Alternative name: "unit". Unit of input (must be one of: cm, m, mm, km, in, ft, yd, mi). | cm | required | |
2 | Alternative name: "width". Width (in the declared unit, with "." as decimal separator). | 0 | required | |
3 | Alternative name: "height". Height (in the declared unit, with "." as decimal separator). | 0 | optional | |
4 | Alternative name: "depth". Depth (in the declared unit, with "." as decimal separator). | 0 | optional | |
prec | Conversion precision (optional number of decimal digits). | 2 | 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 | |
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:
{{Formatnum}}
Localization
This template is localized through {{Autotranslate}}.
To add your language to the list of languages supported by this template, please copy the code of Template:Size/en (or any other language version you prefer to translate) and replace the text strings in there (the form below can be used to create a translation, the English version is preloaded in the edit box). Please change the parameter lang from en (or whatever language you are translating) to the language code of your language.
Examples
| Code | Output | Notes |
|---|---|---|
| {{Size|cm|123}} | 123 cm (48.4 in) | 1D version |
| {{Size|in|123|456}} | 123 cm (48.4 in) × 456 cm (15 ft) | 2D version |
| {{Size|ft|123|456|789}} | 123 cm (48.4 in) × 456 cm (15 ft) × 789 cm (25.9 ft) | 3D version |
| {{Size|unit=m|height=10|width=20}} | Height: 10 m (10.9 yd); Width: 20 m (21.9 yd) | Use of name parameters |
| {{Size|unit=mi|width=10|height=20|depth=30}} | Height: 20 miles (32.2 km); Width: 10 miles (16.1 km); Depth: 30 miles (48.3 km) | Use of name parameters |
| {{Size|cm|12.1234|98.1234|prec=1}} | 12.1 cm (4.8 in) × 98.1 cm (38.6 in) | Use of "prec" parameter |
| {{Size|in|12.12|98.12|lang=fr}} | 12.1 pouces (30.8 cm) × 98.1 pouces (249.2 cm) | Use of "lang" parameter |