Template:Database: Difference between revisions

From Wikishire
Jump to navigation Jump to search
No edit summary
Further units added
Line 2,449: Line 2,449:
|default=name
|default=name
|system=imperial
|system=imperial
|counterpart=km/h<!--Other units to be added-->
|counterpart=km/h
}}
|kg={{#switch:{{{2}}}
|name=kilogram
|symbol=kg
|SI=1
|type=measurement
|quantity=mass
|default=symbol
|system=metric
|counterpart=lb
}}
|g={{#switch:{{{2}}}
|name=gram
|symbol=g
|SI=0.001
|type=measurement
|quantity=mass
|default=symbol
|system=metric
|counterpart=oz
}}
|mg={{#switch:{{{2}}}
|name=milligram
|symbol=mg
|SI=0.000001
|type=measurement
|quantity=mass
|default=symbol
|system=metric
|counterpart=oz
}}
|μg={{#switch:{{{2}}}
|name=microgram
|symbol=μg
|SI=0.000000001
|type=measurement
|quantity=mass
|default=symbol
|system=metric
|counterpart=oz
}}
|tonne={{#switch:{{{2}}}
|name=tonne
|symbol=tonne
|SI=1000
|type=measurement
|quantity=mass
|default=name
|system=metric
|counterpart=ton
}}
|ton={{#switch:{{{2}}}
|name=ton
|symbol=ton
|SI=1,016.0469088
|type=measurement
|quantity=mass
|default=name
|system=imperial
|counterpart=tonne
}}
|tonUS={{#switch:{{{2}}}
|name=short ton
|symbol=US ton
|SI=907.18474
|type=measurement
|quantity=mass
|default=name
|system=American
|counterpart=ton
}}
|st={{#switch:{{{2}}}
|name=stone
|plural=stone
|symbol=st
|SI=6.35029318
|type=measurement
|quantity=mass
|default=name
|system=imperial
|counterpart=kg
}}
|lb={{#switch:{{{2}}}
|name=pound
|symbol=lb
|SI=0.45359237
|type=measurement
|quantity=mass
|default=name
|system=imperial
|counterpart=kg
}}
|oz={{#switch:{{{2}}}
|name=ounce
|symbol=oz
|SI=0.0283495231
|type=measurement
|quantity=mass
|default=symbol
|system=imperial
|counterpart=g
}}
|drachm={{#switch:{{{2}}}
|name=drachm
|symbol=drachm
|SI=0.001771845195
|type=measurement
|quantity=mass
|default=name
|system=traditional
|counterpart=g
}}
|grain={{#switch:{{{2}}}
|name=troy grain
|symbol=grain
|SI=0.00006479891
|type=measurement
|quantity=mass
|default=name
|system=troy weight
|counterpart=g
}}
|pennyweight={{#switch:{{{2}}}
|name=pennyweight
|symbol=dwt
|plural=pennyweight
|SI=0.00155517384
|type=measurement
|quantity=mass
|default=name
|system=troy weight
|counterpart=g
}}
|hundredweight={{#switch:{{{2}}}
|name=hundredweight
|symbol=cwt
|plural=hundredweight
|SI=50.802345
|type=measurement
|quantity=mass
|default=name
|system=imperial
|counterpart=kg
}}
|troy={{#switch:{{{2}}}
|name=troy pound
|symbol=troy
|SI=0.37324
|type=measurement
|quantity=mass
|default=name
|system=troy weight
|counterpart=g
}}
|oz t={{#switch:{{{2}}}
|troy ounce
|symbol=oz t
|SI=0.0311034768
|type=measurement
|quantity=mass
|default=name
|system=troy weight
|counterpart=g
}}
|carat={{#switch:{{{2}}}
|name=carat
|symbol=carat
|SI=0.0002
|type=measurement
|quantity=mass
|default=name
|system=traditional
|counterpart=g
}}
|K={{#switch:{{{2}}}
|name=kelvin
|symbol=K
|SI=1
|plural=kelvin
|type=measurement
|quantity=temperature
|default=symbol
|system=SI
|counterpart=degC
}}
|degC={{#switch:{{{2}}}
|name=degree Celsius
|symbol=°C
|SI=1
|plural=degrees Celsius
|type=measurement
|quantity=temperature
|default=symbol
|system=
|counterpart=degF
}}
|degF={{#switch:{{{2}}}
|name=degree Fahrenheit
|symbol=°F
|SI={{#expr:5/9}}
|plural=degrees Fahrenheit
|type=measurement
|quantity=temperature
|default=symbol
|system=
|counterpart=degC
}}
|degR={{#switch:{{{2}}}
|name=degree Rankine
|symbol=°R
|SI={{#expr:5/9}}
|plural=degrees Rankine
|type=measurement
|quantity=temperature
|default=symbol
|system=
|counterpart=K<!--Other units to be added-->
}} }}<noinclude>{{Database/doc}}
}} }}<noinclude>{{Database/doc}}

Revision as of 22:47, 20 October 2012

Template:Database is a general database constructed as the Mediawiki programme permits, as nested switch functions. The data may be extracted easily whether within an article or in a template.

The database contains counties, territories etc, but also units of measurement, which feed the "Convert" function of Template:Convert.

Examples

The following examples demonstrate how to extract data:

[[File:{{Database|Monmouthshire|flag}}|center|50px]] will give:
{{Database|Monmouthshire|Welsh}} will give: Sir Fynwy

Caution: blank fields

Not every data field is completed nor can be. Care must therefore be taken to ensure that you still achieve the right result in every case.

The first example above but substituting "Ayrshire" in place of "Monmouthshire" would produce an error as there is no Ayrshire flag image, so an {{:if: or {{:ifeq: function should be used where there might be a blank field.