I'm struggling with advanced templates to format c...
# advancedpdf
e
I'm struggling with advanced templates to format currency values according to language. The issue is that in Canada English, a number is written $1,234.56 where in Canada French it is $1 234,56. I found the setting to change formatting based on currency alone, but we need currency + language. If I specify customer's number format in "preferences > number format", this changes the currency formatting on the pdf only, not in the email template. Is there a more elegant way to change the currency formatting in a template other than including something like
<#if locale == "fr_CA">somenumber?replace(",", " ")?replace(".", ",")</#if>
for every currency value that I want to include?
j
I hope there is. Even in SA there is sample code similar to what you have.
r
Have you tried using the nsformat_currency builtin fuction
e
@rustyshackles which currency should I use? I can't find a reference list for that anywhere. I still need to use canadian dollar, just format it differently.
r
Using
nsformat_number
might be better for you. You can find the help link here: https://suiteanswers.custhelp.com/app/answers/detail/a_id/26500/loc/en_US. Below is a screenshot of the relevant section.
e
Oh! I ended up figuring this out actually! The locale number formatting was actually right BUT in order to print the number correctly it had to be coerced to a string formatted currency, instead of a number formatted currency. IE
${record.total}
would print $1,234.56 (english formatting) but
${record.total?string.currency}
prints 1 234,56 $ (french formatting)
🙌🏻 1