cancel
Showing results for 
Search instead for 
Did you mean: 

decimal number separator delimiter comma or point

jmjmrjm
Champ in-the-making
Champ in-the-making
Hello!

I've an Alfresco Community Network - v2.9.0 (B 683) installation running on http://localhost:8089/alfresco/
I've customized web scripts defined at  Company Home > Data Dictionary‬ > Web Scripts Extensions > com > companyname > webscripts > llistats > {*.xml}{*.ftl}

At someplace in the script I've a line defining this sentence
"filesize":<#if doc.isDocument>${(doc.size/1024)?string('0.##')}<#else>""</#if>,


but then, corresponding result of calling directly the script is (for example)
"filesize":0,01,


Why I'm getting a comma as decimal number separator? How can I change it?

Thanks in advance!
3 REPLIES 3

jmjmrjm
Champ in-the-making
Champ in-the-making
maybe I forgot to say that I'm using json format
I mean, I have
/Company Home/Data Dictionary‬/Web Scripts Extensions/org/examples/webscripts/test.get.desc.xml
<webscript>
  <shortname>Webscript test</shortname>
  <description>Webscript test description</description>
  <url>/test</url>
  <authentication>guest</authentication>
  <transaction>required</transaction>
</webscript>

and
  /Company Home/Data Dictionary‬/Web Scripts Extensions/org/examples/webscripts/test.get.json.ftl
hello, this is a test of the decimal separator/delimiter in alfresco
now the number
${(11.1)?string('0.##')}


And I call it trough
http://localhost:8089/alfresco/service/test?format=json


And I get the result
hello, this is a test of the decimal separator/delimiter in alfresco
now the number
11,1

zladuric
Champ on-the-rise
Champ on-the-rise
I believe that this depends on your Locale setting.Freemarker can format numbers in different ways, and to me it helped to read <a href="http://freemarker.sourceforge.net/docs/ref_builtins_number.html">Freemarker builtins for numers</a>. Since then, I had a better understanding of Freemarker. At least I know what could be the problem Smiley Happy

So I believe you should change the locale on your installation to get the default separator to be a dot. Hope that'll at least get you on the right direction.

jmjmrjm
Champ in-the-making
Champ in-the-making
Thanks zladuric

I can put the line
<#setting locale="en_US">

at the begining of every script (*.FTL) to force this locale and get the so much desired decimal delimiter/separator

But I still have the doubt on where is this setting sepecified by default