|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Margodth Smarty Rookie
Joined: 28 Mar 2004 Posts: 11
|
Posted: Mon Jan 09, 2012 11:40 pm Post subject: Facing a culture problem |
|
|
I'm making an app that requires different cultures.
When trying to format numbers I have to format numbers like this
Code: | {$myVar|number_format:2:".":","} |
but depending on the culture it may be comma inverted.
How can I sove this without making different templates for every culture?
Thanks. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Jan 13, 2012 1:18 pm Post subject: |
|
|
Use variables which you assign with the corresponding "." and "," value depending on culture. |
|
Back to top |
|
rodneyrehm Administrator
Joined: 30 Mar 2007 Posts: 674 Location: Germany, border to Switzerland
|
|
Back to top |
|
Margodth Smarty Rookie
Joined: 28 Mar 2004 Posts: 11
|
Posted: Sun Jan 15, 2012 12:25 am Post subject: |
|
|
While rodneyrehm solution looks nicer, U.Tews solution it's easier to implement and iterates less.
I've been trying to implement U.Tews solution before, but I mixed up some things in a not happy way.
That's the way I've solve it.
Code: |
{$total|number_format:2:"{$lang.decimalchar}":"{$lang.thousandchar}"}
|
thanks a lot for the answers. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|