Bug 152535

Summary: "Grand" in subtotal has bad localization.
Product: LibreOffice Reporter: Olivier Hallot <olivier.hallot>
Component: CalcAssignee: Rafael Lima <rafael.palma.lima>
Status: RESOLVED FIXED    
Severity: normal CC: kelemeng, rafael.palma.lima
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=114696
Whiteboard: target:7.6.0
Crash report or crash signature: Regression By:
Attachments: sample file with issue

Description Olivier Hallot 2022-12-16 00:25:02 UTC
Created attachment 184167 [details]
sample file with issue

String used in subtotals is hard to translate, given the mathematical functions used. 

This is the typical case of assembling a string concatenating words, which is bad.

Offending string is  STR_TABLE_GRAND  aka "Grand" in

https://translations.documentfoundation.org/translate/libo_ui-master/scmessages/pt_BR/?checksum=745b915bc731ac01&q=+source%3AGrand+&sort_by=-priority%2Cposition


"Grand Sum" is better translated as "Total geral" and can be "Soma geral"
"Grand Average" is better translated as "Média geral"
...

In general, translation of "Grand "+<subtotal function> is <subtotal function> + "geral" for Brazilian Portuguese, Portuguese and may be other language.

The attachment has the issue shown in the bottom of the "Subtotal" sheet.
Comment 1 Rafael Lima 2022-12-20 00:17:01 UTC
I agree with this request. The way the code was created may work well in English, but in other languages it wouldn't be fine. For example, as pointed out by Olivier, in "Grand Average" the word "Grand" would come second in the translation "Média Geral".

See the code here:
https://opengrok.libreoffice.org/xref/core/sc/source/core/data/table3.cxx?r=a6ec933d#2267

The word "Grand" coming first is hardcoded.

To fix this we would have to create a separate string for all possible functions that can be used. For a list, see here:

https://opengrok.libreoffice.org/xref/core/sc/source/core/data/table3.cxx?r=a6ec933d#2038

For instance, we could have a STR_TABLE_GRAND_AVG, STR_TABLE_GRAND_COUNT and so on.
Comment 2 Rafael Lima 2022-12-21 14:16:19 UTC
Proposed patch available for review here:

https://gerrit.libreoffice.org/c/core/+/144666
Comment 3 Commit Notification 2022-12-22 08:11:43 UTC
Rafael Lima committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f5b3bfbded8ea8d4a0b854a62c82b66747b45833

tdf#152535 Provide better localization for "Grand" subtotal strings

It will be available in 7.6.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 4 Gabor Kelemen (allotropia) 2022-12-22 09:40:40 UTC
This seems to have been one half of the bug 114696