Repository: nvaccess/nvda

Issue:
In MS Excel elements list formulas are always reported in English regardless of the Excel language.
### Steps to reproduce:
1. Start Microsoft Excel in language other than English.
2. Write some formula in the Excel interface language for example =today().
3. Open elements list and switch to formulas.
### Actual behavior:
The formula is shown as '=TODAY()'.
### Expected behavior:
The formula should be shown in the language in which it was entered for example for Polish version of Excel '=DZIŚ()'.
### System configuration
#### NVDA installed/portable/running from source:
Installed
#### NVDA version:
alpha-16458,5e710dac

#### Windows version:
Windows 7 x64
#### Name and version of other software in use when reproducing the issue:
Microsoft Excel 2010 32-bit in Polish
#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your PC?
Yes
#### Have you tried any other versions of NVDA?
Yes 2018.1 and the problem is  present there. I believe it worked correctly in the past, but cannot recall with which version.


Discussion:
@lukaszgo1 wrote:
> #### Have you tried any other versions of NVDA?
> Yes 2018.1 and the problem is present there. I believe it worked correctly in the past, but cannot recall with which version.

At first glance, it seems the way the formula is retrieved has not changed since contribution by @dineshkaushal in 2015.2 as of 06ab8e43bf, although there of course might be side effects I hadn't considered.
Could you please check with older versions of NVDA to ensure localized formulas used to be retrieved and hopefully identify when it turned to English only?

Note: I'm not arguing at all this should be fixed only if it is a regression, I'm convinced this is an issue for any user of non-English locales.
@michaelDCurran this one was an easy fix, as the range object exposes a "FormulaLocal" property, if I recall correctly.
However, since #9257, it's a whole other story...
Would you know whether there is an equivalent to `XLDISPID_RANGE_FORMULA` for localized formulas?
Or maybe just point to the relevant documentation on the used Excel IDispatch DISPIDs?
The dispid you need is: 263


I was able to fetch this by:

Opening Excel and focusing on a cell.

Opening the Python console and running the following command:

nav.excelCellObject._comobj.GetIDsOfNames('formulaLocal')


That is, using the IDispatch interface on an Excel range object, calling 
GetIDsOfNames with the name: formulaLocal.




Resolving patch:
diff --git a/source/NVDAObjects/window/excel.py b/source/NVDAObjects/window/excel.py
--- a/source/NVDAObjects/window/excel.py
+++ b/source/NVDAObjects/window/excel.py
@@ -1,8 +1,7 @@
-#NVDAObjects/excel.py
-#A part of NonVisual Desktop Access (NVDA)
-#Copyright (C) 2006-2016 NV Access Limited, Dinesh Kaushal, Siddhartha Gupta
-#This file is covered by the GNU General Public License.
-#See the file COPYING for more details.
+# A part of NonVisual Desktop Access (NVDA)
+# Copyright (C) 2006-2020 NV Access Limited, Dinesh Kaushal, Siddhartha Gupta, Accessolutions, Julien Cochuyt
+# This file is covered by the GNU General Public License.
+# See the file COPYING for more details.
 
 import abc
 import ctypes
@@ -317,7 +316,7 @@ def __init__( self , nodeType , document , commentObject , commentCollection ):
 class ExcelFormulaQuickNavItem(ExcelRangeBasedQuickNavItem):
 
 	def __init__( self , nodeType , document , formulaObject , formulaCollection ):
-		self.label = formulaObject.address(False,False,1,False) + " " + formulaObject.Formula
+		self.label = formulaObject.address(False, False, 1, False) + " " + formulaObject.FormulaLocal
 		super( ExcelFormulaQuickNavItem , self).__init__( nodeType , document , formulaObject , formulaCollection )
 
 class ExcelQuicknavIterator(object):


Test patch: