Changing Locale in Velocity Script (outputting £ instead of $)

Neil_Robertson6
Level 5

Changing Locale in Velocity Script (outputting £ instead of $)

Hi,

I am outputting some currency values which are in GBP but by default Marketo will output these values as $ when formatting using the following script:

$number.format("currency",$tokenvalue) or number.currency($tokenvalue)

I can see that the server Locale is "en_US" when using this

#set ( $serverLocale = $number.getLocale() )

But I need programmatic control of this and number.setLocale() doesnt seem to work when adding en_GB.

Anyone had to or managed an output to non US currencies?

Tags (1)
3 REPLIES 3
Neil_Robertson6
Level 5

Re: Changing Locale in Velocity Script (outputting £ instead of $)

Is no one else doing currency outputs other than $?!

Nicholas_Manojl
Level 9

Re: Changing Locale in Velocity Script (outputting £ instead of $)

I'm not exactly a pro, in fact I'm not even an amateur and I have zero programming/scripting experience, but this is how I'd do it quick and dirty. so I'm actually keen to see a better solution.

#set ( $price = ${lead.number} )

#if ( ${lead.Country} == "United Kingdom" )

#set ( $currency = "£")

#elseif ( ${lead.Country} != "United Kingdom" )

#set ( $currency = "$" )

#end

<p>your offer will be $currency$price</p>

Anonymous
Not applicable

Re: Changing Locale in Velocity Script (outputting £ instead of $)

Ah, that is how I ended up doing it (sort of).  It's not ideal as you would expect that we can change locale across the board / instance.