European decimal format

1
Hi everyone, I have been trying to get the European decimal format instead of the American decimal format. I have tried different methods, but I have not been successful in achieving it. However, I have found a solution that I would like to discuss. Firstly, I chose a European language that I do not need to use in my app. I added German to my languages from the settings. Then, I went to Language operations and selected all documents. For the operation section, I chose 'Copy'. I selected English (United States) as the source language and German as the destination language. Finally, I clicked on the Apply button, and all the translations were copied. Next, I went back to the Settings and removed all other languages except German, which became the default. After running the app, I was able to use the decimal format as European. However, I also added English (United States) again. I copied the previous German translations back to English, and then I set English as the default language. Surprisingly, it still works fine. 😀 My question is: will this somehow affect the app? Or do you have another approach?
asked
3 answers
0

Language only changes the way a decimal for instance is shown at the frontend with the thousend serperator etc. It does not change the way that decimal is stored in the database. A decimal stays a decimal no matter what language you have.

Regards,

Ronald

 

answered
0

The database, as Ronald described, is only handling dot based decimals.

 

You can let the user fill in a comma based decimal in a string input field.

When using this field to save it to the entity, you can then replace (https://docs.mendix.com/refguide/string-function-calls/#13-replaceall) the comma 9,) with a dot (.).

 

When showing a decimal again in the screen, make sure you translate the dots again to comma's

answered
0

I had a similar problem and wrote the Decimal Tools module to help fix this. It gives you a fuller featured ParseDecimal and FormatDecimal that lets you handle decimals in formats that are different from your current locale.

https://marketplace.mendix.com/link/component/119981

I hope this will help you.

 

answered