Feature #22024
closedSupport localized decimal separators for float values
0%
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
Related issues
Updated by Toshi MARUYAMA almost 9 years ago
- Related to Feature #21677: Support localized decimal separator for hours in the web UI added
Updated by Toshi MARUYAMA almost 9 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
Updated by Liane Hampe over 1 year 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?
Updated by Rafael Neves over 1 year ago
Hi,
It would be great see that patch included in future release.
Nice work !
Best regards
Updated by Liane Hampe over 1 year 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. :)
Updated by Go MAEDA about 1 year ago
- File 22024-v2.patch 22024-v2.patch added
- Target version set to Candidate for next major release
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.
Updated by Rafael Neves almost 1 year ago
I appreciate and agree with that. In fact, the issue is on decimal separator, despite the plus done related to thousand issue.
Updated by Go MAEDA 12 months ago
- Related to Feature #36183: Dynamic decimal separator, according to country setting added
Updated by Go MAEDA 12 months ago
- Related to Defect #6182: Localized decimal numbers added
Updated by Mischa The Evil 12 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.
Updated by Go MAEDA 12 months ago
- File 22024-v3.patch 22024-v3.patch added
- Target version changed from Candidate for next major release to 6.0.0
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.
Updated by Holger Just 12 months ago
- Related to Feature #39997: Add an option to render values of Integer- and Float-format custom fields with thousands delimiters added
Updated by Go MAEDA 12 months ago
- Related to Feature #25012: Allow both '.' and ',' decimal symbols for input of float custom fields added
Updated by Mathias Walter 7 months 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.