Template:Ordinal: Difference between revisions
Template page
More actions
improve polish |
m localised number formats (via a template, as the formatnum: Wiki extension is still outdated on Commons); add Korean, Japanese and Chinese, Thai, Khmer, Lao, Armenian; support localisable plurals in French an Spanish |
||
| Line 1: | Line 1: | ||
{{ifNum|{{{1|}}}| | {{ifNum|{{{1|}}}| | ||
{{LangSwitch|{{#if:{{{lang|}}}|lang|}}={{{lang|}}} | {{LangSwitch|{{#if:{{{lang|}}}|lang|}}={{{lang|}}} | ||
|default = {{#expr:{{{1|}}}}}.<!-- includes at least: cs, fi, hu --> | |default = {{formatnum|{{#expr:{{{1|}}}}}|{{#if:{{{lang|}}}|lang|}}={{{lang|}}}}}.<!-- includes at least: cs, de, fi, hu --> | ||
|en = {{#expr:{{{1|}}}}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#ifeq:{{{style|}}}|d | |br = {{formatnum|{{#expr:{{{1|}}}}}|eo}}-vet | ||
|en = {{formatnum|{{#expr:{{{1|}}}}}|en}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#ifeq:{{{style|}}}|d | |||
| d | | d | ||
| {{#switch:{{#expr:abs({{{1|}}})mod 100}} | | {{#switch:{{#expr:abs({{{1|}}})mod 100}} | ||
| Line 11: | Line 12: | ||
}} | }} | ||
}}{{#ifeq:{{{nosup|}}}|y||</sup>}} | }}{{#ifeq:{{{nosup|}}}|y||</sup>}} | ||
|eo = {{#expr:{{{1|}}}}}-a | |eo = {{formatnum|{{#expr:{{{1|}}}}}|eo}}-a | ||
|es = {{#expr:{{{1|}}}}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#switch:{{{gender|}}}|f=a|#default=o}}{{#ifeq:{{{nosup|}}}|y||</sup>}} | |es = {{formatnum|{{#expr:{{{1|}}}}}|es}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#switch:{{{gender|}}}|f=a|#default=o}}{{PLURAL:{{#expr:{{{number|1}}}}}||s|es}}{{#ifeq:{{{nosup|}}}|y||</sup>}} | ||
|fa = {{#expr:{{{1|}}}}}م | |fa = {{formatnum|{{#expr:{{{1|}}}}}|fa}}م | ||
|fr = {{#switch:{{lc:{{{style|}}}}} | |fr = {{#switch:{{lc:{{{style|}}}}} | ||
|roman|roman year={{Roman|{{{1|}}}}} | |roman|roman year={{Roman|{{{1|}}}}} | ||
|#default={{#expr:{{{1|}}}}} | |#default={{formatnum|{{#expr:{{{1|}}}}}|fr}} | ||
}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#ifexpr:({{{1|}}})=1 | }}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#ifexpr:({{{1|}}})=1 | ||
|{{#switch:{{{gender|}}}|f=re{{# | |{{#switch:{{{gender|}}}|f=re{{PLURAL:{{#expr:{{{number|1}}}||s|fr}}}}|m=er{{PLURAL:{{#expr:{{{number|1}}}}}||s|fr}}|#default=e<!-- avoids agreement error -->}} | ||
|e}}{{#ifeq:{{{nosup|}}}|y||</sup>}} | |e}}{{#ifeq:{{{nosup|}}}|y||</sup>}} | ||
|ia = {{#expr:{{{1|}}}}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#switch:{{#expr:abs({{{1|}}})mod 10}} | |hy = {{formatnum|{{#expr:{{{1|}}}}}|hy}}-րդ | ||
|ia = {{formatnum|{{#expr:{{{1|}}}}}|ia}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#switch:{{#expr:abs({{{1|}}})mod 10}} | |||
|1|7=m | |1|7=m | ||
|2=nd | |2=nd | ||
| Line 28: | Line 30: | ||
|#default=t | |#default=t | ||
}}e{{#ifeq:{{{nosup|}}}|y||</sup>}} | }}e{{#ifeq:{{{nosup|}}}|y||</sup>}} | ||
|mk = {{#expr:{{{1|}}}}}-{{#switch:{{#expr:abs({{{1|}}})mod 10}}|0|5|9=т|1=в|2=р|7|8=м|#default=}}иот | |km = ទី{{formatnum|{{#expr:{{{1|}}}}}|km}} | ||
|ml = {{#expr:{{{1|}}}}}-മത്തെ | |ja = 第{{formatnum|{{#expr:{{{1|}}}}}|ja}}<!-- this is for the adjective in undetermined order before noun; otherwise Japanese use: <cardinal number><noun>目 --> | ||
|no = {{#expr:{{{1|}}}}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#switch:{{#expr:abs({{{1|}}})mod 100}} | |la = ທີ່{{formatnum|{{#expr:{{{1|}}}}}|la}} | ||
|ko = {{formatnum|{{#expr:{{{1|}}}}}|ko}}째 | |||
|mk = {{formatnum|{{#expr:{{{1|}}}}}|mk}}-{{#switch:{{#expr:abs({{{1|}}})mod 10}}|0|5|9=т|1=в|2=р|7|8=м|#default=}}иот | |||
|ml = {{formatnum|{{#expr:{{{1|}}}}}|ml}}-മത്തെ | |||
|ms = ke-{{formatnum|{{#expr:{{{1|}}}}}|ms}} | |||
|no = {{formatnum|{{#expr:{{{1|}}}}}|no}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#switch:{{#expr:abs({{{1|}}})mod 100}} | |||
|1|21|31|41|51|61|71|81|91=st | |1|21|31|41|51|61|71|81|91=st | ||
|2|22|32|42|52|62|72|82|92=dr | |2|22|32|42|52|62|72|82|92=dr | ||
| Line 37: | Line 44: | ||
|#default=d | |#default=d | ||
}}e{{#ifeq:{{{nosup|}}}|y||</sup>}} | }}e{{#ifeq:{{{nosup|}}}|y||</sup>}} | ||
|pl = {{#expr:{{{1|}}}}}-{{#switch:{{#expr:abs({{{1|}}})mod 100}} | |pl = {{formatnum|{{#expr:{{{1|}}}}}|pl}}-{{#switch:{{#expr:abs({{{1|}}})mod 100}} | ||
|1|21|31|41|51|61|71|81|91=sz{{#switch:{{{gender|}}}|f=a|n=e|#default=y}} | |1|21|31|41|51|61|71|81|91=sz{{#switch:{{{gender|}}}|f=a|n=e|#default=y}} | ||
|2|22|32|42|52|62|72|82|92=g{{#switch:{{{gender|}}}|f=a|n=ie|#default=i}} | |2|22|32|42|52|62|72|82|92=g{{#switch:{{{gender|}}}|f=a|n=ie|#default=i}} | ||
| Line 44: | Line 51: | ||
|#default=t{{#switch:{{{gender|}}}|f=a|n=e|#default=y}} | |#default=t{{#switch:{{{gender|}}}|f=a|n=e|#default=y}} | ||
}} | }} | ||
|ru = {{#expr:{{{1|}}}}}-{{#switch:{{{gender|}}}|f=я|n=е|#default=й}} | |ru = {{formatnum|{{#expr:{{{1|}}}}}|ru}}-{{#switch:{{{gender|}}}|f=я|n=е|#default=й}} | ||
|sv = {{formatnum|{{#expr:{{{1|}}}}}|sv}}:<--leading colon, not to be parsed by MediaWiki-->{{PLURAL:{{#expr:{{{number|1}}}}}|a|e|sv}} | |||
|th = ที่{{formatnum|{{#expr:{{{1|}}}}}|th}} | |||
|zh = 第{{formatnum|{{#expr:{{{1|}}}}}|zh}} | |||
|zh-hans = 第{{formatnum|{{#expr:{{{1|}}}}}|zh-hans}} | |||
|zh-hant = 第{{formatnum|{{#expr:{{{1|}}}}}|zh-hant}} | |||
}} | }} | ||
| {{#if:{{{debug|}}}|{{error|1=<span title="Error: not a number">{{{1|}}}</span>}}|{{{1|}}}}} | | {{#if:{{{debug|}}}|{{error|1=<span title="Error: not a number">{{{1|}}}</span>}}|{{{1|}}}}} | ||
Revision as of 23:38, 18 November 2013
This documentation is transcluded from Template:Ordinal/doc.
This template will add the appropriate ordinal suffix to a given integer.
{{Ordinal|101}}, for example, produces Template:Formatnumst.
In English version, for an integer ending in 2 or 3 (except for integers ending in 12 or 13), the ordinal suffix will be -nd and -rd, respectively.
Usage
{{Ordinal |1= |debug= }}
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
1 | positive integer number | empty | optional | |
style | Presentation style. Different options for different languages:
| empty | optional | |
gender | Gender affects ordinal indicators in several languages, including French and Polish. Genders: m for male, f for female and n for neuter. | empty | optional | |
lang | language code of the language in which to display the ordinal number, e.g. en for English, de for German, etc. | {{int:Lang}} | optional | |
nosup | Set nosup=y to display the ordinals without superscript for links and category names. E.g. Template:Formatnumst instead of Template:Formatnumst. | empty | optional | |
debug | empty | optional | ||
Additional information
The template is intended to be used in the following namespaces: all namespaces
The template is intended to be used by the following user groups: all users
Relies on:
Module:Ordinal
See also
- Module:Ordinal
- Module:I18n/ordinal — translations and ordinal formatting schemes used by Module:Ordinal
Examples
| Code | Result |
|---|---|
{{Ordinal|101}} |
Template:Formatnumst |
{{Ordinal|102}} |
Template:Formatnumnd |
{{Ordinal|103}} |
Template:Formatnumrd |
{{Ordinal|104}} |
Template:Formatnumth |
{{Ordinal|1|lang=en}} |
Template:Formatnumst |
{{Ordinal|1|lang=en|style=d}} |
Template:Formatnumd |
{{Ordinal|3|lang=pl}} |
Template:Formatnum-ci |
{{Ordinal|21|lang=fr}} |
Template:Formatnume |
{{Ordinal|21|lang=fr|style=roman}} |
Template:Romane |
{{Ordinal|1|lang=de}} |
Template:Formatnum. |
{{Ordinal|87|lang=es|gender=f}} |
Template:Formatnuma |
{{Ordinal|87|lang=es|gender=f|nosup=y}} |
Template:Formatnuma |