Freemarker format BigDecimal to German Locale not

2019-08-19 00:53发布

问题:

Following the documentation of FreeMarker :

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 ?

回答1:

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.