[development] Translatable strings for 1st/2nd/3rd/nth

Rob Thorne rob at torenware.com
Thu May 3 19:38:16 UTC 2007


Generally speaking, you want to use a general purpose date or number 
formatting libraries for this.  I'm not sure how good the PHP library 
functions are for this (I know more about the Java libraries, which are 
pretty good).  Also, you should not be looking at how to localize things 
like "st" or "nd":  you should be localizing the formats themselves, 
since dates -- where you most often use this in English -- have very 
different formats going even from country to country, as well as from 
language to language.   You probably wouldn't consider writing your own 
encryption library.  You probably don't want to be writing a library 
like this, either.

So I think you have the wrong approach here, unless you intend to write 
a general purpose I18n library on the level of the Java libraries, which 
is a task for an organization on the scale of IBM or Sun.

What exactly are you trying to do here?

Rob

Rob Thorne
Torenware Networks
Chris Kennedy wrote:
> Does anyone have suggestions for creating translatable strings for rankings?
>
> I need to generate strings for 1st/2nd/3rd/4th/etc. ideally without a
> limit, but don't know of a simple translatable solution.
>
> Right now I just have individual t() strings for 1st/2nd/3rd, then a
> blanket t($i .'th') for the rest, under the untested theory that
> translators could manually add translations for Nth into their .po files
> up to a reasonable limit. I realize that this will not work for
> extractor.php purposes and is English-centric.
>
> Thoughts?
>
> Thanks,
> Chris
>   



More information about the development mailing list