Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Size/doc: Difference between revisions

Template page
No edit summary
templatedata
 
(28 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{Lua|Module:Size}}
{{TemplateBox
|1=unit
|1d=Unit of input (must be one of: cm, m, mm, km, in, ft, yd, mi).
|1aliases=1
|1def=cm
|1stat=required


; {{tl|Size}}, {{tl|Dim}}, {{tl|Dimensions}}
|2=height
: To display a 2D size (width × height) both in centimeters and inches, etc. (such as in the "Dimensions" field of a {{m|Painting}} template).
|2d=height (with word "height" displayed)
|2def=
|2stat=optional


; <nowiki>{{Size|1|2|3|4}}</nowiki>
|3=width
# Unit of input (must be one of: cm, m, mm, km, in, ft, yd, mi).
|3d=width (with word "width" displayed)
# Width (in the declared unit, with "." as decimal separator).
|3def=
# Height (in the declared unit, with "." as decimal separator).
|3stat=optional
# Conversion precision (optional number of decimal digits, default: 2).


; Examples
|4=length
<pre>{{Size|cm|123|456}}</pre>
|4d=length (with word "length" displayed)
: {{Size|cm|123|456}}
|4def=
<pre>{{Size|km|12.1234|98.1234|1}}</pre>
|4stat=optional-
: {{Size|km|12.1234|98.1234|1}}
 
|5=depth
|5d=depth (with word "depth" displayed)
|5def=
|5stat=optional-
 
|6=diameter
|6d=diameter (with word "diameter" displayed)
|6def=
|6stat=optional-
 
|7=thickness
|7d=thickness (with word "thickness" displayed)
|7def=
|7stat=optional-
 
|8=prec
|8d=Conversion precision (optional number of decimal digits).
|8def=1 (2 for mm to inches)
|8stat=optional-
 
|9=lang
|9d=language code (only needs to be provided if the language shall be fixed and independant from the user's preferences)
|9def=value of <nowiki>{{int:Lang}}</nowiki>
|9stat=optional-
 
|11=1
|11d=Alternative name for "unit". Unit of input (must be one of: cm, m, mm, km, in, ft, yd, mi). <span style="color:red">Deprecated.</span>
|11def=cm
|11stat=deprecated
 
|12=2
|12d=First dimension measured. <span style="color:red">Deprecated.</span>
|12def=
|12stat=deprecated
 
|13=3
|13d=A second dimension measured. <span style="color:red">Deprecated.</span>
|13def=
|13stat=deprecated
 
|14=4
|14d=A third dimension measured. <span style="color:red">Deprecated.</span>
|14def=
|14stat=deprecated
 
|name=Size
|desc=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 {{t|Artwork}} template.
|namespace=File
|usergroup=
|placement=
|usage-notes=
|type=formatting
|example=
|i18n-method=switch
|i18n-desc=All unit translations are in [[Module:I18n/units]].
|seealso=* {{tl|with frame}}
|setscats=
|lines=one
|shorthand=
|relieson= [[Module:Size]]
}}
 
== {{Section header|Examples}} ==
{{LanguageSelector|be-tarask|ca|en|eo|fr|nl|pl}}
{|border="1" style="right"
|-
! Code
! Output
! Notes
|-
| <nowiki>{{Size|unit=m|height=10|width=20}}</nowiki>
| {{Size|unit=m|height=10|width=20}}
| Use of name parameters
|-
| <nowiki>{{Size|unit=mi|width=10|height=20|depth=30}}</nowiki>
| {{Size|unit=mi|width=10|height=20|depth=30}}
| Use of name parameters
|-
| <nowiki>{{Size|cm|12.1234|98.1234|prec=1}}</nowiki>
| {{Size|cm|12.1234|98.1234|prec=1}}
| Use of "prec" parameter
|-
| <nowiki>{{Size|in|12.12|98.12|lang=fr}}</nowiki>
| {{Size|in|12.12|98.12|lang=fr}}
| Use of "lang" parameter
|-
| <nowiki>{{Size|cm|123}}</nowiki>
| {{Size|cm|123}}
| 1D version
|-
| <nowiki>{{Size|in|123|456}}</nowiki>
| {{Size|in|123|456}}
| 2D version
|-
| <nowiki>{{Size|ft|123|456|789}}</nowiki>
| {{Size|ft|123|456|789}}
| 3D version
|-
|}


<includeonly>
<includeonly>
Line 20: Line 126:
[[Category:Helper templates|{{PAGENAME}}]]
[[Category:Helper templates|{{PAGENAME}}]]
[[Category:Image description templates|{{PAGENAME}}]]
[[Category:Image description templates|{{PAGENAME}}]]
<!--interwikis here-->
</includeonly>
</includeonly>
<templatedata>
{
"params": {
"lang": {
"description": "language code",
"type": "string",
"default": "value of {{int:Lang}}"
},
"unit": {
"description": "Unit of input ",
"example": "mm",
"type": "string",
"suggestedvalues": [
"cm",
"m",
"mm",
"km",
"in",
"ft",
"yd",
"mi"
],
"autovalue": "cm",
"required": true
},
"height": {
"type": "number"
},
"width": {
"type": "number"
},
"length": {
"type": "number"
},
"depth": {
"type": "number"
},
"diameter": {
"type": "number"
},
"thickness": {
"type": "number"
},
"prec": {
"description": "Conversion precision (optional number of decimal digits)",
"default": "1 (2 for mm to inches)",
"autovalue": "1"
}
},
"description": "Displays a size, formatted according to localised format.",
"format": "inline"
}
</templatedata>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.