Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

divide is locale sensitive #14

Closed
ghost opened this issue Sep 8, 2015 · 3 comments
Closed

divide is locale sensitive #14

ghost opened this issue Sep 8, 2015 · 3 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Sep 8, 2015

The divide function seems locale sensitive.
On a computer with fr_FR as the locale (Windows 7 pro) the compiled CSS for say:

width: divide(BIG_MARGIN, 2);

Where BIG_MARGIN equals "25px" is "12,5px" (a comma). One would expect "12.5px" (a dot)

@iflan
Copy link
Member

iflan commented Oct 2, 2015

I've found the problem. In GssFunctions.java, we do:

      String resultString = new DecimalFormat(DECIMAL_FORMAT).format(total);

to format the result. Instead, we should do:

      String resultString = new DecimalFormat(DECIMAL_FORMAT, new DecimalFormatSymbols(Locale.US).format(total);

I'll see if I can create a patch next week.

@ghost
Copy link
Author

ghost commented Oct 2, 2015

That's a good news. Thanks !

@iflan iflan added the bug label Oct 5, 2015
@iflan iflan self-assigned this Oct 5, 2015
iflan added a commit that referenced this issue Oct 6, 2015
We need to protect against the case where the locale uses something
other than '.' to represent the separator between digits and fractions.
See #14.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=104770350
@iflan
Copy link
Member

iflan commented Oct 6, 2015

This is now fixed.

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

No branches or pull requests

1 participant