https://bugs.documentfoundation.org/show_bug.cgi?id=162724
Bug ID: 162724
Summary: CStr() and Format() should produce localized output
for currency values
Product: LibreOffice
Version: 24.8.0.3 release
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: BASIC
Assignee: [email protected]
Reporter: [email protected]
Description:
I personally prefer to have an english user interface, while still being able
to view values with localized formatting. This combination allowed me to
stumble across the issue described below.
- menu / tools / options / languages and locales / general
With single and double values, it is possible to produce localized strings, and
then reparse the original value from it. That however is no longer possible
with currency values.
- x=CSng(1.5) : s=CStr(x) : y=CSng(s) '(y = x) is true
- x=CDbl(1.5) : s=CStr(x) : y=CDbl(s) '(y = x) is true
- x=CCur(1.5) : s=CStr(x) : y=CCur(s) 'CCur(s) throws an ERROR
For currency values, CStr(x) seems to produce culture invariant output (with
"." as decimal separator, instead of "," as configured by my locale settings).
That is in contrary to CStr(x) for single or double values.
Thus far, that behavior didn't seem to be much of an issue since CCur(s) was
still able to reproduce the orginal currency value. However, some time after
LibreOffice version 24.2.5.2 the behavior of CCur(s) must have been changed
such that it now needs localized input to work. As a consequence, CStr() and
Format() may produce output that CCur() fails to process.
VERSION: 24.8.0.3 (X86_64) / LibreOffice Community
LOCALE: de-DE (en_US.UTF-8); UI: en-US
SYSTEM: AppImage on Linux
- locale settings: english interface, german formatting
- CStr(value) produces "1.5000" - ERROR, should be localized
- Format(value, "General Number") - same result
- CCur("1.5000") produces an "inadmissible value" error - ERROR
- CCur("1,5") will return CCur(1.5) - THE ISSUE
VERSION: 7.3.7.2 / LibreOffice Community
LOCALE: de-DE (en_US.UTF-8); UI: en-US
SYSTEM: Preinstalled on Linux Mint
- locale settings: english interface, german formatting
- CStr(value) produces "1.5000" - ERROR, should be localized
- Format(value, "General Number") - same result
- CCur("1.5000") does work
- CCur("1,5") will return CCur(15)
VERSION: 24.2.5.2 (X86_64) / LibreOffice Community
LOCALE: de-DE (de_DE); UI: de-DE
SYSTEM: Windows 10 on a virtual machine
- locale settings: german interface, german formatting
- CStr(value) produces "1.5000" - ERROR, should be localized
- Format(value, "General Number") - same result
- CCur("1.5000") does work
- CCur("1,5") will return CCur(15)
SUMMARY
- CStr() and Format() will consistently produce localized
output with single and double values.
- CSng() and CDbl() allow reproduce the original value
from localized representations (round-trip is possible).
- CCur() now seems to expect localized input,
which CStr() will not produce for currency values.
- CStr() and Format() continue to ignore locale settings
for currency values (round-trip is broken).
POSSIBLE FIX
Change CStr() and Format() such that both produce localized output for currency
values. This would re-enable round-trip conversions. Furthermore, these
functions whould then show consistent behavior across single, double and
currency values.
Steps to Reproduce:
As layed out in the description, and in the attached sample code.
Actual Results:
It is no longer possible to format a currency value using the CStr() or
Format() function, and then expect CCur() to always reproduce the original
value.
Expected Results:
A round-trip (format and reparse the original value) should always be possible.
Furthermore, if CStr() produces localized output for single or double values,
then - as a matter of consistency - CStr() should also produce localized output
for currency values.
Reproducible: Always
User Profile Reset: No
Additional Info:
Version: 24.8.0.3 (X86_64) / LibreOffice Community
Build ID: 0bdf1299c94fe897b119f97f3c613e9dca6be583
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: de-DE (en_US.UTF-8); UI: en-US
Calc: threaded
--
You are receiving this mail because:
You are the assignee for the bug.