Bug 50118 - calc UI "Use English function names" not as it should be
Summary: calc UI "Use English function names" not as it should be
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.5.3 release
Hardware: All All
: medium normal
Assignee: Winfried Donkers
URL:
Whiteboard: target:4.2.0
Keywords:
: 50489 60577 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-19 07:47 UTC by joaquin
Modified: 2016-02-23 15:22 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description joaquin 2012-05-19 07:47:08 UTC
In LibreOffice you can activate this feature under the preferences for "LibreOffice Calc" --> "Forumule" 

I noticed that apparently this feature is not implemented or working completely?

In a sheet using "YEARFRAC" it shows "JAAR.DEEL" with a Dutch locale and this setting activated.
Comment 1 joaquin 2012-06-23 04:59:29 UTC
Same for "JAREN()" instead of "YEARS()", still there in release 3.5.4

How to reproduce:
- install LibreOffice
- install the Dutch language pack (and or other languages)
- start LibreOffice
- select "Use English function names" under "LibreOffice Calc" -> "Formula"
- create a spreadsheet and use some functions e.g.

=YEARFRAC(DATE(2002;6;3);TODAY();1)
=YEARS(DATE(2002;6;3);TODAY();0)

- save the spreadsheet
- change the "Language of" "User interface" in to "Dutch" under "Language Settings" -> "Languages"
- restart the application
- open the saved spreadsheet
- see that the formulas now look like:

=JAAR.DEEL(DATE(2002;6;3);TODAY();1)
=JAREN(DATE(2002;6;3);TODAY();0)

So there is a mixture of English and translated function names. It does not matter when you change the "Formula preference", the combination of "English function names" and a different language for the UI is not showing/using 100% of the function names in English. 

Other languages tested:

Afrikaans (seems to have no translated functions, Afrikaans without "Use English function names" gives the same result):
=YEARFRAC(DATE(2002;6;3);TODAY();1)
=YEARS(DATE(2002;6;3);TODAY();0)

German:
=BRTEILJAHRE(DATE(2002;6;3);TODAY();1)
=JAHRE(DATE(2002;6;3);TODAY();0)

Spanish:
=FRAC.AÑO(DATE(2002;6;3);TODAY();1)
=AÑOS(DATE(2002;6;3);TODAY();0)

==> seems unrelated to the default decimal separator: Afrikaans is using a ".", zo is the combination Spanish with a regional setting of "Puerto Rico" (or any Spanish-speaking north- or middle American country, Mexico - Panamá) instead of Spain or any Spanish-speaking continental south American country, it still shows años.

Does this depend on the UI translation? Can this not be implemented independent from the selected UI? In fact, al languages should behave the same as Afrikaans ;-) (i.e. like there are no translated functions available at all).
Comment 2 bfoman (inactive) 2012-11-26 12:29:57 UTC
(In reply to comment #1)
> - see that the formulas now look like:
> =JAAR.DEEL(DATE(2002;6;3);TODAY();1)
> =JAREN(DATE(2002;6;3);TODAY();0)
> So there is a mixture of English and translated function names.

Confirmed with:
LO 3.6.3.2 
Build ID: 58f22d5
Windows 7 Professional SP1 64 bit
Comment 3 Eike Rathke 2012-12-10 13:17:53 UTC
The non-English names seem to be of functions that are implemented in the Date and Analysis Add-Ins. These currently depend on the resources of the selected UI language.
Comment 4 Winfried Donkers 2013-06-18 08:24:25 UTC
(In reply to comment #3)
> The non-English names seem to be of functions that are implemented in the
> Date and Analysis Add-Ins. These currently depend on the resources of the
> selected UI language.

Eike,
The resource file for e.g. Dutch UI (/translations/source/nl/scaddins/source/analysis.po) contains the msgid (=English function name) and the msgstr (=Dutch function name).
Do you think that it is possible for add-in functions to have local or English names?
If so, I might give it a try ;-)
Comment 5 Winfried Donkers 2013-08-29 08:12:22 UTC
I have finally found the place where the map for Add-in functions is filled:
  ScUnoAddInCollection::ReadFromAddIn()
I have also managed to fill the map depending on the global setting 'use English function names'.
But as the code was clearly intended to work with local add-in function names only, the map is not refilled when the global setting  'use English function names' is changed. That I intend to do next, followed by some testing and cleaning up of my code changes.

It will be some weeks before I can submit a patch.
Comment 6 Commit Notification 2013-10-10 17:16:21 UTC
Winfried Donkers committed a patch related to this issue.
It has been pushed to "master":

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

fdo#50118 use English add-in function names



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 Winfried Donkers 2013-10-11 05:59:10 UTC
With thanks to Eike for making my code changes much neater!

One item needs fixing yet:
Changing the 'Use English function names' settings only works for add-in functions after restart of LibreOffice.
This last fix is a hard nut to crack, I'm not sure if I will be able to in a reasonable time.

On the other hand, this last item is IMHO a minor issue.
Comment 8 Eike Rathke 2014-01-21 00:28:45 UTC
*** Bug 60577 has been marked as a duplicate of this bug. ***
Comment 9 Winfried Donkers 2014-02-14 15:08:35 UTC
Setting status from assigned to new as I don't see possibilities to make the setting work without restarting LibreOffice.
Comment 10 Winfried Donkers 2014-02-14 15:12:04 UTC
*** Bug 50489 has been marked as a duplicate of this bug. ***
Comment 11 Winfried Donkers 2014-04-11 11:06:02 UTC
Patch seems not to work with version 4.2.3 and Dutch locale.
That is, with preference set to 'Use English function names', the add-in function names still are Dutch.

Rebuilding master for Dutch locale to see what happens there...
Comment 12 Winfried Donkers 2014-04-11 11:57:21 UTC
(In reply to comment #11)
> Patch seems not to work with version 4.2.3 and Dutch locale.
> That is, with preference set to 'Use English function names', the add-in
> function names still are Dutch.
> 
> Rebuilding master for Dutch locale to see what happens there...

In master, with UI and locale set to Dutch, it works as expected.

@Eike: can you see if the patch
http://cgit.freedesktop.org/libreoffice/core/commit/?id=ddac824d9c109430f5caad05ca1d84cfcd599c4f
went into 4.2 (or tell me how to find that out)?
Comment 13 Eike Rathke 2014-04-14 13:02:57 UTC
That commit is in the 4-2 branch, it was committed 2013-10-10 on master before the branch-off in November. Easiest to verify is
git log origin/libreoffice-4-2 | grep '^commit ddac824d9c109430f5caad05ca1d84cfcd599c4f'

However, remember that Add-In function names are displayed in English only after a restart of LibreOffice. I just tried with 4.2.3 in a de_DE locale and it worked.
Comment 14 Winfried Donkers 2014-04-15 07:46:09 UTC
(In reply to comment #13)
> That commit is in the 4-2 branch, it was committed 2013-10-10 on master
> before the branch-off in November. Easiest to verify is
> git log origin/libreoffice-4-2 | grep '^commit
> ddac824d9c109430f5caad05ca1d84cfcd599c4f'
Thank you, found it, thanks to your hint.
 
> However, remember that Add-In function names are displayed in English only
> after a restart of LibreOffice. I just tried with 4.2.3 in a de_DE locale
> and it worked.
I remember, it was the reason that I didn't close this bug report.
I double checked, with a brand new installation of 4.2.3 (nl-NL locale) on a new Windows7 installation:
(use English function names is off)
-open new calc document
-enter in A1: =ERF(1); result #NAME
-enter in B1: =FOUTFUNCTIE(1): result 0,804..
-save document
-set option use English function names on
-restart LibreOffice
-open document
-result: both A1 and B1 contain =FOUTFUNCTIE(1), with result 0,804..

To be able to debug this, I would need some git tips: how can I switch to branch libreoffice-4-2 so that I can make a debug-build?
Comment 15 Eike Rathke 2014-04-17 10:27:38 UTC
Assuming that you don't want to spoil your current master build, clone the repository and checkout the branch, which is (all on one line):

git clone -b "$BRANCH" --reference "$BOOTSTRAP_DIR" git://gerrit.libreoffice.org/core "$DEST_DIR"

where
$BRANCH obviously is the branch to checkout, here libreoffice-4-2 (or libreoffice-4-2-3)
$BOOTSTRAP_DIR is the location of the already existing repo
$DEST_DIR is the destination directory where to create the repo and checkout sources, it must not exist yet

Then cd $DEST_DIR and
git submodule update --reference "$BOOTSTRAP_DIR"

Then configure (./autogen.sh) with the additional option
--with-referenced-git=$BOOTSTRAP_DIR"
Comment 16 Winfried Donkers 2014-04-17 10:45:56 UTC
(In reply to comment #15)

Thank you for your help, I will start on this once I have finished my first (partial) patch for AGGREGATE. 
Multi-tasking is something I don't master myself ;-)
Comment 17 Winfried Donkers 2014-04-18 15:15:52 UTC
I just built version 4.2.5.0: the patch is active and working correctly with Dutch locale...

I think I'll just wait how version 4.2.4 will behave and then close this bug (if it behaves well).
Comment 18 Winfried Donkers 2014-04-22 07:04:33 UTC
(In reply to comment #17)
> I just built version 4.2.5.0: the patch is active and working correctly with
> Dutch locale...
> 
> I think I'll just wait how version 4.2.4 will behave and then close this bug
> (if it behaves well).

I don't get it: just downloaded and installed version 4.2.4.1 for Windows:
-opened Calc
-Use English Function Names is true
-ERF() is not recognised, but FOUTFUNCTIE() is

-removed registrymodifications.xcu (when soffice.exe/bin were closed)
-opened calc, set Use English Function Names to true
-closed Calc and the quickstarter
-opened Calc
-ERF() is not recognised, but FOUTFUNCTIE() is

I have no clue where to look for the cause...
Comment 19 Winfried Donkers 2014-04-23 08:45:11 UTC
On a clean computer (HD formatted and Windows 7 newly installed):
-installed LibreOffice 4.2.3 (full install)
-opened calc and entered in cell A1 =ERF(1). Result #NAME, as expected
-in options set Use English Function Names to true
-closed Calc and the quickstarter
-opened Calc and entered in cell A1 =ERF(1). Result #NAME, which should be 0.8427
-checked in options: Use English Function Names is set

Windows 7 is Dutch version, 32bit, professional edition
LibreOffice has not been changed in any way afer installation except for the Use English Function Names setting.
LibreOffice locale is nl-NL.
Comment 20 Winfried Donkers 2014-05-09 15:11:37 UTC
I have come to the conclusion that the persisting problem in version 4.2 (including 4.2.4.2) is specific for the Dutch locale.
Setting the locale to e.g. German results in English function names for all functions (including Add-in functions).
Setting the locale to Dutch results in English function names except for the Add-in functions, which remain in Dutch.

I cannot reproduce the problem with Linux (versions master and 4.2), it solely occurs happen with Windows (7), version 4.2.x and Dutch UI/locale.

I don't think the cause has anything to do with my code changes.
Comment 21 Winfried Donkers 2014-07-09 15:27:48 UTC
I checked with version 4.2.5.2 on Windows 7 (NL): all works fine :-)
Comment 22 Winfried Donkers 2014-07-09 15:33:36 UTC
*** Bug 60577 has been marked as a duplicate of this bug. ***