Module talk:Ordinal
Initial implemention
[edit]The goal was to preserve the legacy output from original {{Ordinal}} template in the cases where the original template implemented a particular language. This implementation does so, except for three cases:
- Spanish — the original Ordinal always outputs values as 32e, regardless of gender. This disagrees with multiple sources. This module outputs Spanish ordinals as either 33.o or 34.a depending on gender . See Module_talk:Ordinal/testcases.
- The "d" style for English (i.e. English legal style ordinals). The original template code, by default, would superscript the "d". This does not match conventional legal style for ordinals, as the Bluebook and other citation authorities forbid superscripted ordinals.
- The original template did not report an error if you supplied zero or a negative number, even if you turned on "debug". The current code treats zero and negative numbers as an error condition.
TODO:
Module:Formatnum doesn't currently have a Lua-friendly method, just a template method, so I'm using expandTemplate to call it. I really should refactor 'main' in Module:Formatnum into two functions to avoid this (but it's used in thousands and thousands of images, so I didn't want to risk breaking something at this point).
—RP88 (talk) 04:47, 28 December 2014 (UTC)
- With regards to the TODO, I improved the code to create a child frame object and pass it as an argument to a direct call to Formatnum instead of using template expansion. This is quite a bit better than using expandTemplate, but obviously not ideal. I really should investigate refactoring Module:Formatnum... —RP88 (talk) 05:30, 29 December 2014 (UTC)
- Jarekt updated Module:Formatnum, so I've updated Ordinal to call its new Lua-friendly method directly. All done, yay! —RP88 (talk) 15:11, 29 December 2014 (UTC)
Catalan rules
[edit]Trying to define rules for Catalan, see Special:Diff/184667453 with special forms for ordinals 1-4, I think the best option is to expand rule 'gendered-suffix-one' to one-digit, that is for value<10 with mod10. Current uses will not be broken as 'suffix_2', etc, defaults to 'suffix'. Do you think this approach is appropiate? --V.Riullop (talk) 16:10, 14 January 2016 (UTC)
Ukrainian
[edit]I've added partial support for Ukrainian to Module:I18n/ordinal, and wrote tests. To fully support the language, Module:Ordinal also has to be edited. Due to the unique rules (the numbers 0, 40, and all numbers ending with …000 are treated specially), I believe a new scheme has to be added.
One can refer to the first row in the table here, and to the template here. DmitTrix (talk) 19:36, 19 October 2018 (UTC)
- User:RP88 I am not sure if you have seen this request. Can you help? --Jarekt (talk) 17:08, 25 October 2018 (UTC)
- @DmitTrix and Jarekt: I'll go ahead and add a rule to correctly handle Ukrainian ordinals. However, I'm probably going to need some clarification of how zero should be handled. Currently this module always treats zero as an error, since ordinal numbers represent position (or rank) in a sequential order. In every other language currently supported there is no "zero" ordinal. For example, in English, if you have a list of three items you can specifiy the first, second, or third, but not the "zero"-th. Is a zero ordinal unique to Ukranian? —RP88 (talk) 19:11, 25 October 2018 (UTC)
- @RP88: "Zeroth" is not unique to Ukrainian – see wikt:zeroth and en:English numerals#Ordinal numbers. It's actually common in scientific (especially mathematical) and computer science contexts, where items in a list or sequence may be numbered starting from zero. This use is not language-specific. More than that, it's not uncommon to have "minus first", "minus second", etc. items in these contexts. DmitTrix (talk) 12:56, 27 October 2018 (UTC)
- @DmitTrix: I'm afraid my statement was poorly worded, sorry. I am aware that in English "zeroth" has been coined as the zero ordinal for use in certain mathematical or engineering contexts. When I made my statement I was referring just to the contexts in which this module is used, but in retrospect I can see that this was not at all clear. Currently this module does not attempt to correctly grammatically format all possible uses of ordinals (particularly given the large diversity of the Commons-supported languages). For example, this module does not currently support a grammatical case parameter like the Ukrainian template you referenced. Even this module's existing gender parameter is already problematic (as grammatical gender is not necessarily consistent between the supported languages in all contexts). Currently this complexity is partially addressed by just restricting the scope of this module to internationalizing the contents of the fields of Commons Infobox templates. In this context, ordinal numbers appear almost exclusively in dates (via templates such as {{Other date}} to format dates such as "20th century", etc.), but is also used for locations (such as museum floor numbers in {{Artwork}} (speaking of which, maybe you could add Ukrainian support to {{Floor}})) and edition numbers (via {{Cite book}}). Looking into the issue, Ukrainian appears to be identical to the other supported languages in these contexts, in that an input value of zero is always an error (i.e. the century before the first century is not the zeroth century, the floor below the first floor is not the zeroth floor, etc.). I'm happy to update this module, please let me know if in Ukranian the zero ordinal appears in dates or locations, and if so, how. Alternatively, if you can suggest a context on Commons where this module's lack of support for the zero ordinal is problematic, I am willing and happy to expand this module to add explicit support for the zero ordinal, but the initial language coverage would likely be weak (as the translations used here mostly came from the old Commons Ordinal template code, which never supported the zero ordinal). For that matter, if you can suggest a context on Commons where this module's lack of support for grammatical case is problematic please let me know, and I'll see about adding support for case as well. —RP88 (talk) 19:08, 27 October 2018 (UTC)
- @RP88: (sorry, was busy IRL, and could not reply earlier…)
- Thanks for the detailed info! I had a more general usage in mind; your explanations made things more clear for me.
- First, do you think that removing the test for "0" from this template may result in not detecting some errors (such as "0th century" slipping in undetected somewhere)? If you don't see any such risk, then maybe it's worth removing the restriction in this template anyway…
- Second, with regards to a context where "0th" may be needed, it's not uncommon to have "0th floor" in some areas (e.g. in Israel) – so maybe the {{Floor}} template (that you've mentioned above) does need to support it, and hence does this module, too. I don't have any specific example though…
- Third, regarding grammatical case – I wasn't able to find any specific example on Commons where this would be of use, so probably this can be set to low priority until really needed.
- DmitTrix (talk) 14:12, 5 November 2018 (UTC)
- @DmitTrix: I'm afraid my statement was poorly worded, sorry. I am aware that in English "zeroth" has been coined as the zero ordinal for use in certain mathematical or engineering contexts. When I made my statement I was referring just to the contexts in which this module is used, but in retrospect I can see that this was not at all clear. Currently this module does not attempt to correctly grammatically format all possible uses of ordinals (particularly given the large diversity of the Commons-supported languages). For example, this module does not currently support a grammatical case parameter like the Ukrainian template you referenced. Even this module's existing gender parameter is already problematic (as grammatical gender is not necessarily consistent between the supported languages in all contexts). Currently this complexity is partially addressed by just restricting the scope of this module to internationalizing the contents of the fields of Commons Infobox templates. In this context, ordinal numbers appear almost exclusively in dates (via templates such as {{Other date}} to format dates such as "20th century", etc.), but is also used for locations (such as museum floor numbers in {{Artwork}} (speaking of which, maybe you could add Ukrainian support to {{Floor}})) and edition numbers (via {{Cite book}}). Looking into the issue, Ukrainian appears to be identical to the other supported languages in these contexts, in that an input value of zero is always an error (i.e. the century before the first century is not the zeroth century, the floor below the first floor is not the zeroth floor, etc.). I'm happy to update this module, please let me know if in Ukranian the zero ordinal appears in dates or locations, and if so, how. Alternatively, if you can suggest a context on Commons where this module's lack of support for the zero ordinal is problematic, I am willing and happy to expand this module to add explicit support for the zero ordinal, but the initial language coverage would likely be weak (as the translations used here mostly came from the old Commons Ordinal template code, which never supported the zero ordinal). For that matter, if you can suggest a context on Commons where this module's lack of support for grammatical case is problematic please let me know, and I'll see about adding support for case as well. —RP88 (talk) 19:08, 27 October 2018 (UTC)
- @RP88: "Zeroth" is not unique to Ukrainian – see wikt:zeroth and en:English numerals#Ordinal numbers. It's actually common in scientific (especially mathematical) and computer science contexts, where items in a list or sequence may be numbered starting from zero. This use is not language-specific. More than that, it's not uncommon to have "minus first", "minus second", etc. items in these contexts. DmitTrix (talk) 12:56, 27 October 2018 (UTC)
- @DmitTrix and Jarekt: I'll go ahead and add a rule to correctly handle Ukrainian ordinals. However, I'm probably going to need some clarification of how zero should be handled. Currently this module always treats zero as an error, since ordinal numbers represent position (or rank) in a sequential order. In every other language currently supported there is no "zero" ordinal. For example, in English, if you have a list of three items you can specifiy the first, second, or third, but not the "zero"-th. Is a zero ordinal unique to Ukranian? —RP88 (talk) 19:11, 25 October 2018 (UTC)