Ordinal endings

Felipe Gasper felipe at felipegasper.com
Sat Feb 27 19:17:08 CST 2016


	I’m wanting to make a function that takes in an integer and a locale 
tag and spits out the ordinal form of that integer in the given locale. 
For example:

to_ordinal( 5, 'en' ) => '5th',
to_ordinal( 1, 'fr' ) => '1er',

	I know this is tricky because in many cases (e.g., the second example 
that I posted!) the ordinal form will depend on more context--for 
example, in French it could be (something like) “1er” or “1ère”.

	Only English seems to have the actual text of the ordinal endings in 
CLDR … is that because there are but few languages whose ordinal forms 
are simple enough to require no additional context?

	Thank you!

-Felipe Gasper
Houston, TX

More information about the CLDR-Users mailing list