Using it-IT in language settings results in crazy numbers in fluoro detail

Issue #693 resolved
Ed McDonagh created an issue

Summary box has missing numbers and numbers that are many orders of magnitude too large, likewise for event doses.

Not tested yet but assumed to affect all languages that use a comma for decimal marker.

Comments (23)

  1. Ed McDonagh reporter

    There are numbers missing on the filtered list pages too if it-IT is used.

    @dplatten, @LuukO, anyone, if you fancy working out what is going on and you might get there sooner than me, please do! Otherwise I'll see if I can work it out later.

  2. Luuk

    I got a bit nervous as I'm living in a country that uses a comma for decimal marker. The server I'm running OpenREM on is set like this in Windows, but imports seem fine (and also summary boxes are fine). Or do you mean the language code in In the the language code is not changed in my case (so still on 'en-us').

  3. Ed McDonagh reporter

    This will get the right number on the page, but we'd end up with a mix of comma and decimal separators for the European localisations:

    {% load l10n %}
    <script>document.write({{ accum_integrated.dose_rp_total|unlocalize }}.toPrecision(3));</script>

    Thoughts anyone?

  4. Ed McDonagh reporter

    I can just turn off localisation for the page, so that all the number formats are the same throughout. Seems a bit blunt though.

  5. Luuk

    I didn't test it, but would

    <script>document.write({{ accum_integrated.dose_rp_total | floatformat:3 }});</script>

    do the trick? So use the Django functionality instead of the java toPrecision?

  6. Ed McDonagh reporter

    I think floatformat will give decimal places, whereas toPrecision gives significant figures

  7. Ed McDonagh reporter

    Perfect. I'll give it a try later - if we can use that then we can drop all the javascript formatting :-) However, it might fall foul of the commas too, we'll have to have a look.

  8. Ed McDonagh reporter

    Tested with various values to trigger the issue avoided by testing for greater than 0 - issue is taking a log10 of 0, so <0 test is good.

  9. Log in to comment