Skip to main content

Numbers

sign

Mathematical sign function: -1 for negative numbers, 0 for 0, +1 for positive numbers

ln

Localized number: Formats number according to domain settings. For example, the filter uses the decimal point for English but the comma for Czech.

Examples:

  • English:

    • {{0|ln}}0
    • {{1.2|ln}}1.20
    • {{1200|ln}}1200
    • {{12000|ln}}12,000
    • {{12000000|ln}}12,000,000
  • Czech:

    • {{0|ln}}0
    • {{1.2|ln}}1,20
    • {{1200|ln}}1200
    • {{12000|ln}}12.000
    • {{12000000|ln}}12,000.000

numeral

Translates digits into words if supported; returns the original expression otherwise.

Examples:

  • English:

    • {{1|numeral}}one
    • {{5|numeral}}five
    • {{0|numeral}}0
    • {{30|numeral}}30
  • Czech:

    • {{1|numeral}}jeden
    • {{5|numeral}}pět
    • {{0|numeral}}0
    • {{30|numeral}}30

unit

Generates counted expressions using digits only. This filter supports the morphology-related arguments.

Examples:

  • English:

    • {{0|unit('box')}}0 boxes
    • {{1|unit('box')}}1 box
    • {{1|unit('box', prep='with')}}with 1 box
    • {{2|unit('box')}}2 boxes
    • {{5|unit('box')}}5 boxes
  • Czech:

    • {{0|unit('bedna')}}0 beden
    • {{1|unit('bedna')}}1 bedna
    • {{1|unit('bedna', m='7', prep='s')}}s 1 bednou
    • {{2|unit('bedna')}}2 bedny
    • {{2|unit('bedna', m='7', prep='s')}}s 2 bednami
    • {{5|unit('bedna')}}5 beden
    • {{5|unit('bedna', m='7', prep='s')}}s 5 bednami

unitNum

Generates counted expressions using words for numbers less than 11. This filter supports the morphology-related arguments. For currency units, see money(Short) filters below.

Examples:

  • English:

    • {{0|unitNum('box')}}0 boxes
    • {{1|unitNum('box')}}one box
    • {{5|unitNum('box')}}five boxes
    • {{5|unitNum('box', m='#1')}} {{'be'|m('@1')}} closedfive boxes are closed
    • {{15|unitNum('box')}}15 boxes
  • Czech:

    • {{0|unitNum('bedna')}}0 beden
    • {{1|unitNum('bedna')}}jedna bedna
    • {{1|unitNum('stůl')}}jeden stůl
    • {{2|unitNum('bedna')}}dvě bedny
    • {{2|unitNum('stůl')}}dva stoly
    • {{5|unitNum('bedna')}}pět beden
    • {{5|unitNum('stůl')}}pět stolů
    • {{15|unitNum('bedna')}}15 beden
    • {{5|unitNum('bedna', m='7', prep='s')}}s pěti bednami
    • {{1|unitNum('bedna', m='#1')}} {{'být'|m('r@1')}} {{'zavřený'|m('@1')}}jedna bedna byla zavřená
    • {{2|unitNum('bedna', m='#1')}} {{'být'|m('r@1')}} {{'zavřený'|m('@1')}}dvě bedny byly zavřené
    • {{5|unitNum('bedna', m='#1')}} {{'být'|m('r@1')}} {{'zavřený'|m('@1')}}pět beden bylo zavřených
    • {{15|unitNum('bedna', m='#1')}} {{'být'|m('r@1')}} {{'zavřený'|m('@1')}}15 beden bylo zavřených

Notes:

  • Agreement with unitNum cannot be combined with the capitalize filter at this time.

    • unsupported: {{5|unitNum('bedna', m='#1')|capitalize}} {{'být'|m('r@1')}} {{'zavřený'|m('@1')}}
  • Pluralum-tantum nouns (scissors, nůžky, ..) are not supported yet.

money, moneyShort (Cs)

Generates money expression. Currently supported currencies: CZK, EUR, USD, GBP. This filter supports the morphology-related arguments. The full variant (money) generates the money expressions in words (only for the supported currencies and only informal variants, e.g., dolar instead of americký dolar in Czech). The short variant (moneyShort) formats the number and adds the currency symbol. For unsupported currencies, the currency from the input is used both as currency word (money) or currency symbol (moneyShort). For both variants, the preferred type of the input is string (to avoid rounding errors), but float/integer are also accepted. The amount is rounded to two decimal places.

Examples:

  • English: not supported yet

  • Czech:

    • {{'25.48'|money('CZK')}}25 korun 48 haléřů
    • {{'25.48'|moneyShort('CZK')}}25,48 Kč
    • {{25.48|money('CZK')}}25 korun 48 haléřů
    • {{25.48|moneyShort('CZK')}}25,48 Kč
    • {{'25.00'|money('CZK')}}25 korun
    • {{'25.00'|moneyShort('CZK')}}25 Kč (without .00)
    • {{'0.01'|money('CZK')}}jeden haléř
    • {{'0.01'|moneyShort('CZK')}}0,01 Kč
    • {{'0.19'|money('CZK')}}19 haléřů
    • {{'0.19'|moneyShort('CZK')}}0,19 Kč
    • {{'0.1928'|money('CZK')}}19 haléřů
    • {{'0.1928'|moneyShort('CZK')}}0,19 Kč
    • {{'25.48'|money('GBP')}}25 liber 48 pencí
    • {{'25.48'|moneyShort('GBP')}}£25,48
    • {{'1'|money('CZK', m='Case=Loc')}}jedné koruně
    • {{'0.01'|money('CZK', m='Case=Gen')}}jednoho haléře
    • {{'15.2'|moneyShort('JPY')}}15,20 JPY (unsupported currency)
    • {{'15.2'|money('JPY')}}15,20 JPY (unsupported currency)

ord_numeral_in_words

Translates cardinal number into ordinal

Example:

  • English:

    • {{3|ord_numeral_in_words}}.third
    • {{13|ord_numeral_in_words}}.13th
  • Czech:

    • {{3|ord_numeral_in_words}}.třetí
    • {{13|ord_numeral_in_words}.13.
    • {{3|ord_numeral_in_words|capitalize}}.Třetí
    • {{2|ord_numeral_in_words|m('@1')}} {{'Slavia'|m('#1')}}druhá Slavia
    • {{2|ord_numeral_in_words|m('@1')}} {{'Baník'|m('#1')}}druhý Baník
    • {{'Slavia'|m('#1')}} {{'skončit'|m('r@1')}} {{2|ord_numeral_in_words|m('@1')}}.Slavia skončila druhá.
    • {{'Baník'|m('#1')}} {{'skončit'|m('r@1')}} {{2|ord_numeral_in_words|m('@1')}}.Baník skončil druhý.

Note: Agreement of ord_numeral_in_words cannot be combined with the capitalize filter at this time.