Project

General

Profile

Actions

Feature #22024

closed

Support localized decimal separators for float values

Added by Rafael Neves over 8 years ago. Updated 10 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
I18n
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

Hi.I´m using redmine 2.6.2. I have created a custom field wich type is float. I want to use comma as decimal separator.

But when i set locale to , pt or pt-BR, for instance, if the user inputs a
float like '95,70' or '500,25' in a form input, numerical
validation will yield an 'invalid_number' error, even though this is a
valid format in Brazil.

Only works if i use dot as decimal separator... but it is not the right way to do it.

Is that a newer version of redmine that fix it ?

How we that uses comma as decimal separator deals with with number formats in redmine?

Thanks!


Files

support-localized-decimal-separator.patch (3.87 KB) support-localized-decimal-separator.patch Liane Hampe, 2023-09-05 18:25
22024-v2.patch (3.83 KB) 22024-v2.patch Go MAEDA, 2023-12-30 10:14
22024-v3.patch (7.03 KB) 22024-v3.patch Go MAEDA, 2024-01-01 11:26

Related issues

Related to Redmine - Feature #21677: Support localized decimal separator for hours in the web UIClosedGo MAEDA

Actions
Related to Redmine - Feature #36183: Dynamic decimal separator, according to country settingClosed

Actions
Related to Redmine - Defect #6182: Localized decimal numbersClosed2010-08-20

Actions
Related to Redmine - Feature #39997: Add an option to render values of Integer- and Float-format custom fields with thousands delimitersNew

Actions
Related to Redmine - Feature #25012: Allow both '.' and ',' decimal symbols for input of float custom fieldsClosed

Actions
Actions #1

Updated by Toshi MARUYAMA over 8 years ago

  • Related to Feature #21677: Support localized decimal separator for hours in the web UI added
Actions #2

Updated by Toshi MARUYAMA over 8 years ago

  • Subject changed from decimal separator in float custom filed doesn´t work to Validation error on float custom filed in case of i18n decimal separator
Actions #3

Updated by Rafael Neves over 8 years ago

thanks!

Actions #4

Updated by Liane Hampe 10 months ago

Hi,

I'd like to set the focus on the missing support for localized decimal separators and delimiters in custom fields of format 'float' again. That is, inserting for example

# Separator problem
42,5 --> won't currently be valid.
The user needs to type in 
42.5 instead.

# Delimiter problem
10000,99 should be rendered as 10.000,00 instead.

There are several issues (#25012, #36183) addressing this problem and a lot of countries using the decimal comma instead of dot as you can see here: https://en.wikipedia.org/wiki/Decimal_separator.

I provided a patch solving this issue. It also includes tests.

Probably, there are many Redmine users which would appreciate this improvement.

Would be nice seeing it in a future release! :)

What are your thoughts?

Actions #5

Updated by Rafael Neves 10 months ago

Hi,

It would be great see that patch included in future release.

Nice work !

Best regards

Actions #6

Updated by Liane Hampe 10 months ago

Go MAEDA: Please note the patch (https://www.redmine.org/issues/22024#note-4) for supporting localized decimal separators and delimiters in float custom field values.

I would love to see it in a future release. :)

Actions #7

Updated by C S 9 months ago

+1
Relation: #36183

Actions #8

Updated by Go MAEDA 6 months ago

Liane Hampe wrote in #note-6:

Go MAEDA: Please note the patch (https://www.redmine.org/issues/22024#note-4) for supporting localized decimal separators and delimiters in float custom field values.

Thank you for posting the patch. I think the patch makes it more user-friendly for international users.

The patch by Liane Hampe also adds the ability to display thousand delimiters. However, I think displaying thousand delimiters should be out of the scope of this patch. This is because not all users may agree with always displaying the thousand delimiter. Additionally, at this time, entering a value with a thousand delimiter into a custom field results in a validation error. In my opinion, the feature to display thousand delimiters should be discussed in another issue.

I have updated the patch for the current trunk and removed the feature to display thousand delimiters.

Actions #9

Updated by Rafael Neves 6 months ago

I appreciate and agree with that. In fact, the issue is on decimal separator, despite the plus done related to thousand issue.

Actions #10

Updated by Go MAEDA 6 months ago

  • Related to Feature #36183: Dynamic decimal separator, according to country setting added
Actions #11

Updated by Go MAEDA 6 months ago

Actions #12

Updated by Mischa The Evil 6 months ago

Go MAEDA wrote in #note-8:

[...] at this time, entering a value with a thousand delimiter into a custom field results in a validation error. In my opinion, the feature to display thousand delimiters should be discussed in another issue.

I have updated the patch for the current trunk and removed the feature to display thousand delimiters.

I agree with that. A separate, additional feature providing a custom field option (using field_attributes?) to display thousand delimiters for selected Float (but also Integer) custom fields could be nice to have in some cases when dealing with larger values, but that's not related to the decimal separator issue indeed (nor is it fully covered by the solution in the provided patch). I've opened issue #39997 for that.
However, I think that Redmine doesn't need to provide support for entering values with thousands delimiters into a custom field. It feels like overkill to me.

Regarding the v2-patch: it looks good to me, but the proposed method test_float_field_should_format_with_various_locale_separator_and_delimiter doesn't explicitly test anything delimiter related anymore, so maybe it's better to drop the postfix from its name.

About the scheduling: given the potential impact of the proposed changes downstream, I agree with bringing this in a major release, but why not in 6.0.0? The current state of this patch seems pretty complete to me.
OTOH, it might be desirable for downstream compatibility maintenance to bring this change together in one go with the contextually-related, currently yet incomplete issues #21677 and #35726 (with #31637). If it is deemed a desired feature, then also #39997, would ideally be brought along with those at the same time too.

Actions #13

Updated by Go MAEDA 6 months ago

Updated the patch again.
Estimated hours, spent time, and PDF export now also support internationalized decimal separator.

Mischa The Evil wrote in #note-12:

Regarding the v2-patch: it looks good to me, but the proposed method test_float_field_should_format_with_various_locale_separator_and_delimiter doesn't explicitly test anything delimiter related anymore, so maybe it's better to drop the postfix from its name.

Fixed. Thank you.

Setting the target version to 6.0.0.

Actions #14

Updated by Holger Just 6 months ago

  • Related to Feature #39997: Add an option to render values of Integer- and Float-format custom fields with thousands delimiters added
Actions #15

Updated by Go MAEDA 6 months ago

  • Related to Feature #25012: Allow both '.' and ',' decimal symbols for input of float custom fields added
Actions #16

Updated by Go MAEDA 6 months ago

  • Tracker changed from Defect to Feature
  • Subject changed from Validation error on float custom filed in case of i18n decimal separator to Support locale-dependent decimal separators for float values
  • Affected version deleted (2.6.2)
Actions #17

Updated by Go MAEDA 6 months ago

  • Subject changed from Support locale-dependent decimal separators for float values to Support localized decimal separators for float values
Actions #18

Updated by Go MAEDA 6 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed Liane Hampe 's patch with slight changes in r22592. Also, I added support for PDF export in r22594.
Thank you for your contribution.

Actions #19

Updated by Mathias Walter 10 days ago

Can this patch included in 5.1.x, too? It does not require any new dependencies. Hence, it should be easy to apply it.

Actions

Also available in: Atom PDF