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

Florian Loretan floretan at gmail.com
Thu May 3 02:08:42 UTC 2007

The t( ) mechanism is very simple but in a few cases like the one you
mentioned (1st, 2nd, 3rd, nth...) it does create some issues that make it
impossible to have a correct translation. Another case is for months
translation, where the abbreviation for "May" is "May", so that in languages
where that month is longer (like in Italian "Maggio") there can't be both a
full month name and an abbreviation.

One option would be change the t( ) mechanism so that its input is a key
instead of the English translation. In most cases, the key would be the
English translation as it currently is, but it would also be possible to set
the key of a message to be different from the English value. For the example
mentioned above we would have:

  'may_short' => ('en' -> 'May', 'it' -> 'Maggio' )
  'may_long' => ('en' -> 'May', 'it' -> 'Maggio' )

This change would make drupal's translation mechanism less English-centric.
There's of course some issues with these modifications, mainly knowing what
the best way to specify keys/messages is, but it would probably make things
more adaptable languages other than English, which seems to be one of the
big focuses of the 6.x release.


On 5/2/07, Chris Kennedy <chrisken at mail.utexas.edu> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070502/91ab8581/attachment-0001.htm 

More information about the development mailing list