Template:Ordinal: Difference between revisions
Template page
More actions
adding <sup> for Norwegian |
m the correct feminine suffix of the 1st ordinal in French is 're', not 'ère'; better format for default language is "<nowiki>{{{1}}}.<nowiki>" (same as cs, fi, hu) instead of just "<nowiki>{{{1}}}<nowiki>" like cardinals; add Spanish |
||
| Line 1: | Line 1: | ||
{{ifNum | {{{1|}}} | {{LangSwitch | {{ifNum|{{{1|}}}| | ||
{{LangSwitch|{{#if:{{{lang|}}}|lang|}}={{{lang|}}} | |||
|default = {{{1}}}.<!-- includes at least: cs, fi, hu --> | |||
|en = {{{1}}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#ifeq:{{{style|}}}|d | |||
| d | |||
| {{#switch:{{#expr:abs({{{1}}})mod 100}} | |||
|1|21|31|41|51|61|71|81|91=st | |||
|2|22|32|42|52|62|72|82|92=nd | |||
|3|23|33|43|53|63|73|83|93=rd | |||
|#default=th | |||
}} | |||
}}{{#ifeq:{{{nosup|}}}|y||</sup>}} | }}{{#ifeq:{{{nosup|}}}|y||</sup>}} | ||
|eo = {{{1}}}-a | |||
|es = {{{1}}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#switch:{{{gender|}}}|f=a|#default=o}}{{#ifeq:{{{nosup|}}}|y||</sup>}} | |||
|fa = {{{1}}}م | |||
|fr = {{#switch:{{lc:{{{style|}}}}} | |||
|roman|roman year={{Roman|{{{1|}}}}} | |||
|#default={{{1|}}} | |||
}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#ifexpr:({{{1|}}})=1 | |||
|{{#switch:{{{gender|}}}|f=re{{#switch:{{{number|}}}|p=s|#default=}}|m=er{{#switch:{{{number|}}}|p=s|#default=}}|#default=e<!-- avoids agreement error -->}} | |||
|e}}{{#ifeq:{{{nosup|}}}|y||</sup>}} | |||
|ia = {{{1}}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#switch:{{#expr:abs({{{1}}})mod 10}} | |||
|1|7=m | |||
|2=nd | |||
|3=ti | |||
|8=v | |||
|9=n | |||
|#default=t | |||
}}e{{#ifeq:{{{nosup|}}}|y||</sup>}} | |||
|mk = {{{1}}}-{{#switch:{{#expr:abs({{{1}}})mod 10}}|0|5|9=т|1=в|2=р|7|8=м|#default=}}иот | |||
|ml = {{{1}}}-മത്തെ | |||
|no = {{{1}}}{{#ifeq:{{{nosup|}}}|y||<sup>}}{{#switch:{{#expr:abs({{{1}}})mod 100}} | |||
|1|21|31|41|51|61|71|81|91=st | |||
|2|22|32|42|52|62|72|82|92=dr | |||
|3|23|33|43|53|63|73|83|93=dj | |||
|5|25|35|45|55|65|75|85|95|6|26|36|46|56|66|76|86|96=t | |||
|#default=d | |||
}}e{{#ifeq:{{{nosup|}}}|y||</sup>}} | |||
|pl = {{{1}}}-{{#switch:{{#expr:abs({{{1}}})mod 10}} | |||
|1=sz{{#switch:{{{gender|}}}|f=a|n=e|#default=y}} | |||
|2=g{{#switch:{{{gender|}}}|f=a|n=ie|#default=i}} | |||
|3=ci{{#switch:{{{gender|}}}|f=a|n=e|#default=}} | |||
|7|8=m{{#switch:{{{gender|}}}|f=a|n=e|#default=y}} | |||
|#default=t{{#switch:{{{gender|}}}|f=a|n=e|#default=y}} | |||
}} | |||
|ru = {{{1}}}-{{#switch:{{{gender|}}}|f=я|n=е|#default=й}} | |||
}} | |||
| {{#if:{{{debug|}}}|{{error|1=<span title="Error: not a number">{{{1|}}}</span>}}|{{{1|}}}}} | |||
}}<noinclude> | |||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> | ||
Revision as of 03: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 101st.
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. 101st instead of 101st. | 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}} |
101st |
{{Ordinal|102}} |
102nd |
{{Ordinal|103}} |
103rd |
{{Ordinal|104}} |
104th |
{{Ordinal|1|lang=en}} |
1st |
{{Ordinal|1|lang=en|style=d}} |
1d |
{{Ordinal|3|lang=pl}} |
3-ci |
{{Ordinal|21|lang=fr}} |
21e |
{{Ordinal|21|lang=fr|style=roman}} |
Template:Romane |
{{Ordinal|1|lang=de}} |
1. |
{{Ordinal|87|lang=es|gender=f}} |
87a |
{{Ordinal|87|lang=es|gender=f|nosup=y}} |
87a |