[development] localization of currency, float, dates accordingly to language chosen

Gábor Hojtsy gabor at hojtsy.hu
Wed Oct 10 14:29:19 UTC 2007


On 10/10/07, Ivan Sergio Borgonovo <mail at webthatworks.it> wrote:
> Is there a site-wide facility (core or module 5.2) to output formatted
> currency, float and dates accordingly to the language chosen by the
> user?
>
> Anything that could be integrated with i18n or localizer[1]?
>
> If I had to provide site-wide functions that just read user or session
> cfg for language and apply proper formatting where is the best place
> to put them?
>
> [1] any other choice?

- currencies are easy if the module in question has that in t(), like
t('@symbol @amount') can be translated to '@symbol at amount' or
'@amount at symbol', although I am not sure you mean this by currencies
- float numbers are printed with number_format(), or they should be at
least, which does not support different formatting based on languages.
Feel free to suggest new functionality to do this, which can be tested
in real life scenarios in D6 and integrated to D7.
- date formats are Drupal settings and as such are translatable with
the settings translations features of i18n and localizer

Gabor


More information about the development mailing list