Search code examples
formattingfreemarkerbigdecimal

Freemarker format BigDecimal to German Locale not working properly


Following the documentation of FreeMarker :

enter image description here

Using :

<#setting number_format="0.##">
<#setting locale="hu">
German people write: ${12345678}

Should output as shown in picture but instead what i get is the below :

For input new BigDecimal(4436372342.10) => 4 436 372 342,10

which doesn't have . but instead has spaces .

Why that happens ?


Solution

  • Seems like there is a documentation error.

    locale="hu"
    

    sets a Hungarian locale. Its thousands separator is ' '.

    To set a German locale, try

    locale="de_DE" 
    

    instead. That has '.' as thousands separator.