Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numbers and currency formating decimals #724

Closed
danilozuchold opened this issue Dec 23, 2023 · 1 comment
Closed

numbers and currency formating decimals #724

danilozuchold opened this issue Dec 23, 2023 · 1 comment

Comments

@danilozuchold
Copy link

Hello,

First of all, thank you for developing docassemble! It's super powerful and I really enjoy using it.

One thing I'm struggling with: decimal formatting in currency fields or number fields doesn't work as expected. Most European countries use a comma “,” to separate decimals and a period “.” to separate thousands, for excample one million looks like 1.000.00,00.

I'm using DA in the docker container. I set locales in docker container to de_DE.UTF-8
root@fa6527070667:/# locale
LANG=de_DE.UTF-8
LANGUAGE=de_DE:de
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=de_DE.UTF-8

The Docassemble configuration for the language looks like this
language: de
locale: DE.utf8 (also tried de_DE.UTF-8)
os locale: de_DE.UTF-8 UTF-8

When I create an interview with currency or number fields, input validation reports an error if comma is used as a decimal separator.
Am I missing something or is this actually a bug?

image

@danilozuchold danilozuchold changed the title numbers an currency formating decimals numbers and currency formating decimals Dec 23, 2023
@jhpyle
Copy link
Owner

jhpyle commented Dec 23, 2023

Docassemble's locale support controls what happens on the server (in the realm of Python and the C libraries that support it, which are influenced by the OS configuration). In the web browser, there is very limited support for locale-switching. JavaScript assumes that numbers use . for the decimal. Docassemble relies on the jQuery Validation Plugin, which does not support different locale representations of numbers. I did try once to support different locales in the browser, but I found it was too complex and I gave up. So in the browser, numbers have to use . as the decimal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants