Bug 67836 - Macros: Translation from Formula to FormulaLocal in a Cellobject
Summary: Macros: Translation from Formula to FormulaLocal in a Cellobject
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.0.4 release
Hardware: x86-64 (AMD64) Linux (All)
: high major
Assignee: Eike Rathke
URL:
Whiteboard: target:4.2.0 target:4.1.2
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-06 17:38 UTC by Herbert Stalp
Modified: 2013-08-30 20:56 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
A sheet with a button to reproduce the bug (9.47 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-08-06 17:38 UTC, Herbert Stalp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Herbert Stalp 2013-08-06 17:38:07 UTC
Created attachment 83728 [details]
A sheet with a button to reproduce the bug

Problem description: Formula function will not be translated in FormulaLocal

Steps to reproduce: If I create a formula in a macro like
o_tab_arb.getcellbyposition(5,i).formula="=if(e"+format(str(i+1),0)+">0;""N"";"""")" 
or ....formula="=now()" 
the translation to FormulaLocal does not work, so I get an error. The cell contains =if(E5>0;... instead of=wenn(E5>0;... or now() instead of jetzt()

Current behavior: Produces an Error #NAME?

Expected behavior: No error an translation in FormulaLocal

              
Operating System: openSUSE
Version: 4.1.0.4 release
Last worked in: 4.0.4.2 release
Comment 1 Herbert Stalp 2013-08-26 13:12:35 UTC
Last worked in: Version 4.0.5.2 (Build ID: 5464147a081647a250913f19c0715bca595af2f)
Comment 2 Andrew Pitonyak 2013-08-30 02:36:27 UTC
I am also looking at this to see if this is a bug (or not).

I asked a person in Lithuania to run a simple example in LO 4.0 and 4.1. I am in the US so this is not an easy test for myself. 

In 4.0 the properties Formula and FormulaLocal give the expected result:

cell.Formula =  "=2.1*2"    => 4,2
cell.Formula =  "=2,1*2"    => #NAME?

cell.FormulaLocal =  "=2,1*2"   => 4,2
cell.FormulaLocal =  "=2.1*2"   =>  #NAME?

In 4.1 the both properties Formula and FormulaLocal give the same result:

cell.Formula =  "=2,1*2"    => 4,2
cell.Formula =  "=2.1*2"    => #NAME?

cell.FormulaLocal =  "=2,1*2"   => 4,2
cell.FormulaLocal =  "=2.1*2"   =>  #NAME?

Clearly something changed when they went to 4.1.
Comment 3 Eike Rathke 2013-08-30 19:18:01 UTC
Note: to clarify the initial description, in a German UI and 'de-DE' locale with the testcase document it is the .Formula="=if(..." that does not work, a .FormulaLocal="=wenn(..." works.

For "=2,1*2" or "=2.1*2" it depends on the current work locale (not UI language) what the actual result is, .Formula="=2.1*2" should always use 'en-US' locale and separators but apparently does not.
Comment 4 Andrew Pitonyak 2013-08-30 19:48:38 UTC
Yes, that about sums it up. Formula should always use en-US but does not. 

Spent some time poking around the code trying to find where this is done and I think that I found were FormulaLocal is set, but not Formula.
Comment 5 Eike Rathke 2013-08-30 20:16:44 UTC
Taking.
Comment 6 Commit Notification 2013-08-30 20:46:49 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

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

resolved fdo#67836 do not overwrite already interpreted English cell



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 7 Eike Rathke 2013-08-30 20:47:28 UTC
Pending review for 4-1 as https://gerrit.libreoffice.org/5712
Comment 8 Commit Notification 2013-08-30 20:56:55 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2ea6f5e741bb21649fb438bf7b8b4ac523d0085e&h=libreoffice-4-1

resolved fdo#67836 do not overwrite already interpreted English cell


It will be available in LibreOffice 4.1.2.

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.