Copy link to clipboard
Copied
If have some code that sets multiple Locales -->
<cfset currentlocale = SetLocale("English (Canadian)")>
<cfset currentlocale = SetLocale("English (UK)")>
<cfset currentlocale = SetLocale("English (US)")>
In-between these different settings I have #LSCurrencyFormat(GetTotal.TotalValue)#
This displays the currency and the appropriate currency sign.
The question I have is how would I do this for Europe as I now have a need to support Euro's
Thanks
Mark
Copy link to clipboard
Copied
Copy link to clipboard
Copied
unfortunately it didn't work. It is inheriting the last SetLocale, so if I setLocale to UK I get a pound sign, if I set it to US I get a dollar sign
Copy link to clipboard
Copied
Hmm.. maybe submit a bug ticket on that.. it's _supposed_ to include the Euro symbol if the locale is set to a country that has adapted the Euro. Did you use all three arguments?
V/r,
^ _ ^
Copy link to clipboard
Copied
I used #LSEuroCurrencyFormat(GetTotalEUR.TotalValue)#
Looking on here there does not appear to be an argument that would display a € euro sign
ColdFusion Help | LSEuroCurrencyFormat
I've just played around a little and it looks like I could make it work with this
€#NumberFormat(GetTotalEUR.TotalValue,',___.__')#
I had to put the € side outside of the numberformat, if I use this it would crash
#NumberFormat(GetTotalEUR.TotalValue,'€,___.__')#
It was happy with a $ sign inside the numberformat but not the €
The ,___.__ seems to format fine no matter how bit the number I get the required comma's as well.
It would have been nice to do it with the correct LSEuroCurrency, but it looks like mission accomplished
Edit: Should be €#NumberFormat(GetTotalEUR.TotalValue,',.__')# to remove a space between the currency sign and the value, but still display two decimal places and commas
Copy link to clipboard
Copied
According to the help page, there isn't a 'mask' argument, so that shouldn't work.
Parameter | Description |
---|---|
currency | Currency value. |
locale | Locale to use instead of the locale of the page when processing the function |
type |
|
I was thinking along the lines of: #LSEuroCurrencyFormat(GetTotalEUR.TotalValue,'English (UK)','local')#
V/r,
^ _ ^
Copy link to clipboard
Copied
that won't give the single euro sign. I edited my previous message while you were posting, the solution above seems to do the trick
Copy link to clipboard
Copied
That should be sent to Adobe Tracker.
If you are using JDK 1.4 or later, then perhaps the LSCurrencyFormat() will work.
V/r,
^ _ ^
Copy link to clipboard
Copied
I am CF2016 with the JDK 11.0.2
Adobe tracker is for bugs? Not sure how to submit.
LSCurrencyformat does not seem to contain a euro symbol.
Copy link to clipboard
Copied
https://tracker.adobe.com is for submitting (and searching) bugs. This, I think, qualifies as a bug.
I'll try it on my DEV environment. What value is GetTotalEUR.TotalValue returning?
V/r,
^ _ ^
Copy link to clipboard
Copied
Any value had the same results, but it looks like it's possible as above using Dutch to get the euro sign, but you get a space, the numberformat works better
Copy link to clipboard
Copied
I tried with "1.234,56" and was told that cannot be converted to a number. When I tried it with 1234.56, it works as long as I set French (Standard) as the locale, but it puts the Euro symbol _after_ the amount.
<cfset SetLocale("French (Standard)") />
<cfoutput>#LSEuroCurrencyFormat(1234.56)#</cfoutput>
V/r,
^ _ ^
Copy link to clipboard
Copied
In my case the number will also be a real currency value, so I'd never have 1,234.56 as a value from the database.
Copy link to clipboard
Copied
https://forums.adobe.com/people/ACS+LLC wrote
Looking on here there does not appear to be an argument that would display a € euro sign
If you copy the example from that documentation page and paste it into https://cffiddle.org/ and run it, you will see it does produce a euro symbol, but it has a space before the number much like you found with the numberFormat() function.
Copy link to clipboard
Copied
I tried it, and see that if a local such as Dutch is selected you get the euro sign, as you say with a space.
I've just modified and tested various scenarios with my numberformat version and it seems to work fine with no space.
I think it's good enough to mark as the right answer