Bug 81671 - RTL: reconsider Arabic decimal separator handling
Summary: RTL: reconsider Arabic decimal separator handling
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Localization (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: high major
Assignee: Eike Rathke
URL:
Whiteboard: target:6.0.0
Keywords:
Depends on:
Blocks: User-Locale RTL-Arabic Decimal-Separator-Key
  Show dependency treegraph
 
Reported: 2014-07-23 11:24 UTC by Yousef El-Sayed
Modified: 2017-10-27 18:33 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Wrong sum with Arabic decimals (2.78 KB, image/png)
2014-07-23 11:24 UTC, Yousef El-Sayed
Details
Test document reopened in arabic locale (89.80 KB, image/png)
2014-07-27 16:49 UTC, Yousuf Philips (jay)
Details
sample ods mentioned in comment 4 (8.54 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-10-12 14:36 UTC, Yousuf Philips (jay)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yousef El-Sayed 2014-07-23 11:24:21 UTC
Created attachment 103331 [details]
Wrong sum with Arabic decimals

Hello,

In LibreOffice Calc when I do

- Tools --> Options --> Languages settings --> Local setting : Arabic (Egypt)
- Tools --> Options --> Languages settings : checked "Complex Text Layout"
- Tools --> Options --> Languages settings --> Complex Text Layout --> Numeral = Hindi



and put any numbers with decimals as for example (1.2 or 1.3 , etc), the app calculates sums wrongly. 

For example as you can see in the attachment which has the following but with Arabic numbers

A1: 1.2 , B1: 1.3 , C1:  =SUM(A1:B1)

C1 is supposed to be (2.5), but it is "zero"

PS: The app calculate Arabic numbers correctly but without any decimals.
Comment 1 Yousef El-Sayed 2014-07-23 11:46:20 UTC
I tried 
A1: 1,2 , B1: 1,3 , C1:  =SUM(A1:B1)
It didn't work too.
Comment 2 Joel Madero 2014-07-27 01:34:33 UTC
@Jay - you mind taking a look at this one?
Comment 3 Yousuf Philips (jay) 2014-07-27 16:45:38 UTC
Confirmed in LibO 4.1.6, 4.2.5, 4.3.0.3 on Linux Mint. With an english local setting and complex text layout numeral set to hindi, it works fine, but changing the local setting to arabic (egypt) it doesnt work.

So i created the example with local setting = english and saved it. Then changed local setting to arabic and reopened the file and the decimal points had turned into commas. It isnt the standard comma (ascii 44), it turned to the arabic unicode comma (U+066B / hex values d9 ab).

This issue seem to be related to the Tools > Options > Languages settings > Decimal separator key. As with this checked or not checked as 'Same as Local Setting', it doesnt make it work with a decimal point.
Comment 4 Yousuf Philips (jay) 2014-07-27 16:49:48 UTC
Created attachment 103548 [details]
Test document reopened in arabic locale

first line shows how the decimal points have turned into unicode arabic commas and the calculation still works. second and third line show that using a decimal point or comma wont work in arabic locale.
Comment 5 Eike Rathke 2014-08-13 11:06:16 UTC
The Arabic ar-EG (and other) locale data defines
U+066B "٫" ARABIC DECIMAL SEPARATOR
as decimal separator, hence a digit sequence containing the '.' dot separator is not converted to a numeric input but stays text.

Is the Arabic decimal separator actually used with Hindi (ASCII) digits?
If yes, why is '.' dot expected to work in an Arabic locale?
If not, what separator is used, ',' comma (I assume) or '.' dot?
Comment 6 Yousef El-Sayed 2014-08-14 07:01:12 UTC
Thank you Eike. The numbers in attachments should be called "Arabic digits" not "Hindi digits".Yes, as Arab when we write digits we use the decimal "٫". But in all available Arabic Layout like (Arabic/azerty/digits/Morroco...etc) there is only the "." not "٫". We have to use the unicode not "Shift + a key".

As a suggestion, if developers can write some kind of a script which converts "." to "٫" only when the local setting is set to Arabic, it'll be fixed.
Comment 7 Eike Rathke 2014-08-14 09:23:30 UTC
(In reply to comment #6)
> The numbers in attachments should be called "Arabic digits"
> not "Hindi digits".

Yes, sure, I got carried away, sorry for confusion.

> As a suggestion, if developers can write some kind of a script which
> converts "." to "٫" only when the local setting is set to Arabic, it'll be
> fixed.

I'll see what I can do in the number scanner.
Comment 8 Yousef El-Sayed 2014-08-15 15:58:13 UTC
Thank you, Eike. Good luck.
Comment 9 Yousuf Philips (jay) 2014-08-19 12:28:45 UTC
As libreoffice saved '.' and displayed it as the arabic unicode ',' when opening it in the arabic locale, so with an arabic locale, i think libreoffice should take the inputted '.' and display it as the arabic unicode ',' when it knows its a number.

Does another bug report need to be filed because the unchecked 'Same as Local Setting' doesnt work correctly.
Comment 10 Yousuf Philips (jay) 2017-10-12 14:36:56 UTC
Created attachment 136925 [details]
sample ods mentioned in comment 4
Comment 11 Yousuf Philips (jay) 2017-10-12 16:55:50 UTC
Still present. So i checked the help on 'Same as Local Setting' and get what it is saying, but the setting isnt useful to users who dont have/use the number pad.

Version: 6.0.0.0.alpha0+
Build ID: 4d1ee296def5fde9c77702d3d19d76be33cbdaad
CPU threads: 2; OS: Linux 4.4; UI render: default; VCL: gtk2; 
Locale: ar-EG (en_US.UTF-8); Calc: group
Comment 12 Commit Notification 2017-10-26 19:35:51 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4ef04974882ba53daef3977e84c1844077b77e9b

New decimalSeparatorAlternative, LocaleDataItem2, XLocaleData5, tdf#81671

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2017-10-27 01:07:10 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ba9f44d6ee560bbba09834b1070d19ec62d35783

Implement LocaleData2, XLocaleData5, LocaleDataItem2, tdf#81671

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2017-10-27 16:30:57 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=89e0a9183e7b21596bcd5504b104bf816f1d3ef3

Resolves: tdf#81671 add DecimalSeparatorAlternative to ar-* and fa-IR

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Eike Rathke 2017-10-27 16:43:14 UTC
And a series of a dozen or so commits in between that were not added as notifications despite they mentioned the bug number..
Comment 16 Commit Notification 2017-10-27 17:02:39 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ab7b10d6c37af426c782e8cb46563bc206e5881c

Fix build of Windows-only code, tdf#81671 follow-up

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Commit Notification 2017-10-27 17:09:27 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ae531b69b3d8f0aa1bb1438e0af63b0710c9c47a

Another ImpGetIntntlSep() fix, tdf#81671 follow-up

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Adolfo Jayme 2017-10-27 18:33:05 UTC
Re: comment #15, all of Eike’s commits: https://cgit.freedesktop.org/libreoffice/core/log/?qt=grep&q=tdf%2381671