Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Formatting German Numbers


Go to End


2 Posts   928 Views

Avatar
Silverfish

Community Member, 59 Posts

19 January 2012 at 5:15am

Hi All,

in our current Project we have a lot of German Prices / Number. They look like 1.034,98, so the delimiters are exactly the other way than american (international?).
Is there a way to reconfigure the general outputted format in all templates, formfields and CMS formfieds to that format?

Of course i found

i18n::set_locale('de_DE');

but this seems only to support formats for date and time formats.

As always, I would be grateful for any hint! :)

Regards
SF.

Avatar
Devlin

Community Member, 344 Posts

20 January 2012 at 10:55pm

Edited: 20/01/2012 11:16pm

setlocale(LC_ALL, array('de_DE.UTF-8','de_DE') ); does format numbers with a comma as a decimal seperator. But this is generally a bad idea, because it is not working with everything -- and things easily get really messed up.
It is better just to check the locale and format the output for the template resp. input of the form with a wrapper method.