Module:UnitPlural/doc

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by imported>RexxS at 15:02, 14 October 2019 (Creating Module:UnitPlural/doc). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function main

[edit source]

The main function takes a number and unit name (|quantity=) and an optional language code (|lang=) from the frame.

It returns the quantity with proper plural units in the given language, if it can.

It will find use when the quantity is returned from Wikidata, so that the numerical value is not yet known.

Examples

[edit source]
  • {{#invoke:UnitPlural |main |quantity=1 week}} → 1 week
  • {{#invoke:UnitPlural |main |quantity=3 week}} → 3 weeks
  • {{#invoke:UnitPlural |main |quantity=3.50 week}} → 3.50 weeks
  • {{#invoke:UnitPlural |main |quantity=1 foot}} → 1 foot
  • {{#invoke:UnitPlural |main |quantity=3 foot}} → 3 feet
  • {{#invoke:UnitPlural |main |quantity=1 mile per hour}} → 1 mile per hour
  • {{#invoke:UnitPlural |main |quantity=3 mile per hour}} → 3 miles per hour
  • {{#invoke:UnitPlural |main |quantity=1 standard gravity}} → 1 standard gravity
  • {{#invoke:UnitPlural |main |quantity=3 standard gravity}} → 3 standard gravities
  • {{#invoke:UnitPlural |main |quantity=1 foot}} → 1 solar mass
  • {{#invoke:UnitPlural |main |quantity=3 solar mass}} → 3 solar masses

Function plural

[edit source]

Function plural is equivalent to function main(frame), but takes parameters for use in other modules. The langcode is optional and is "en" by default on Lua error in Module:WikidataIB at line 3061: attempt to index field 'wikibase' (a nil value)..

  • quant = plural(quant, langcode)

Function pl

[edit source]

Function pl returns the plural of the unit name, and takes parameters for use in other modules. The langcode is optional and is "en" by default on Lua error in Module:WikidataIB at line 3061: attempt to index field 'wikibase' (a nil value)..

  • unitnameplural = pl(unitname, langcode)