[development] Translatable strings for 1st/2nd/3rd/nth
Earnie Boyd
earnie at users.sourceforge.net
Thu May 3 19:19:04 UTC 2007
Quoting Gabor Hojtsy <gabor at hojtsy.hu>:
> Earnie Boyd wrote:
>> Quoting Chris Kennedy <chrisken at mail.utexas.edu>:
>>> 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?
>>
>> Are there existing math libraries that might help? Simple solution
>> might be a SQL table that you add the exceptions to 'th' to. So the
>> translation for 1 would contain 1st and the translation for 2 would
>> 2nd and your 'th' default would be suffixed for everything else.
>
> Earnie, how would that SQL table work for translations? Different
> languages need very different suffixes. I don't see what table
> structure you envision here.
>
Chris was looking for "simple" and and realized his needs are
"English-centric" but was wanting some way to possibly support simple
translation.
int|locale|string
1|en|st
2|en|nd
So now he creates a function to look for the passed int value and
locale and appends the suffix or some administrated set default. No it
doesn't fit all scenarios.
Frankly, I would suggest using t('first'), t('second'), etc instead of
the lazy symbols.
Earnie
More information about the development
mailing list