Bug 158555 - [NatNum12] does not allow literal text to the left of 0
Summary: [NatNum12] does not allow literal text to the left of 0
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.1 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-Cells
  Show dependency treegraph
 
Reported: 2023-12-05 19:36 UTC by Mike Kaganski
Modified: 2023-12-08 06:06 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 Mike Kaganski 2023-12-05 19:36:50 UTC
It is possible to have

  [NatNum12]0" some text"

but this doesn't work:

  [NatNum12]"some text "0
Comment 1 ady 2023-12-05 20:02:54 UTC
Confirmed by my tests in tdf#158502.
Comment 2 m_a_riosv 2023-12-05 23:11:35 UTC
But seems to work if there are parameters on the NatNum

[NatNum12 D=ordinal]\"D MMM\"
shows
"first Dec"
for a date in the cell 1/12/2023
Comment 3 ady 2023-12-06 01:58:07 UTC
(In reply to m.a.riosv from comment #2)
> But seems to work if there are parameters on the NatNum
> 
> [NatNum12 D=ordinal]\"D MMM\"
> shows
> "first Dec"
> for a date in the cell 1/12/2023

I'm sorry but I don't understand. What exact literal text is being added to that number format code?

OTOH, having the following format code seems to show the additional literal text correctly:

[NatNum12 D=ordinal]"Ending date: "\"D MMM\"

The problem is with things like:
[NatNum12 D=ordinal]"Total: "0

or with:

[NatNum12]"Total: "0.00

IOW, somehow the additional quotation marks are needed (as for text)
Total: "\"0.00\"

but I'm not sure that such code (or a similar one) would end up with the desired result to be displayed in each variant.
Comment 4 Lobaluna 2023-12-06 03:14:43 UTC
Confirmed.

Version: 7.6.3.1 (X86_64)
Build ID: 60(Build:1)
CPU threads: 8; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: es-MX (es_MX.UTF-8); UI: es-ES
Calc: threaded
Comment 5 m_a_riosv 2023-12-06 14:16:56 UTC
(In reply to ady from comment #3)
> (In reply to m.a.riosv from comment #2)
> > But seems to work if there are parameters on the NatNum
> > 
> > [NatNum12 D=ordinal]\"D MMM\"
> > shows
> > "first Dec"
> > for a date in the cell 1/12/2023
> 
> I'm sorry but I don't understand. What exact literal text is being added to
> that number format code?
> 
> OTOH, having the following format code seems to show the additional literal
> text correctly:
> 
> [NatNum12 D=ordinal]"Ending date: "\"D MMM\"
> 
> The problem is with things like:
> [NatNum12 D=ordinal]"Total: "0
> 
> or with:
> 
> [NatNum12]"Total: "0.00
> 
> IOW, somehow the additional quotation marks are needed (as for text)
> Total: "\"0.00\"
> 
> but I'm not sure that such code (or a similar one) would end up with the
> desired result to be displayed in each variant.

Quotes, one more example.
[NatNum12 D=ordinal]\""hola" \" D MMM => "hola " third Jan
Comment 6 ady 2023-12-06 14:59:12 UTC
(In reply to m.a.riosv from comment #5)

> Quotes, one more example.
> [NatNum12 D=ordinal]\""hola" \" D MMM => "hola " third Jan

Let's be more specific, to clarify what is not working.

"D MMM" is a **DATE** format > seems to be working.

Now, what about a **NUMBER** format? > it is not working as expected (with a recent LO 24.2 alpha).

Examples:
--------

Cell Value (with decimal point):
1.23

[NatNum12 capitalize EUR]0.00
One euro and twenty-three cents

Format:
[NatNum12 capitalize EUR]\""Total: "\"0.00
Actual result:
"Total: "1.23
Expected result:
"Total: "One euro and twenty-three cents


[NatNum12 capitalize EUR]\"Total: \"0.00
"Total: "1.23

[NatNum12 capitalize EUR]"Total: "0.00
Total: 1.23

[NatNum12 capitalize EUR]Total: 0.00
Total: 1.23


[NatNum12 cardinal]0.00
one point two three

[NatNum12 cardinal]\""Total: "\"0.00
"Total: "1.23

[NatNum12 cardinal]\"Total: \"0.00
"Total: "1.23

[NatNum12 cardinal]"Total: "0.00
Total: 1.23

[NatNum12 cardinal]Total: 0.00
Total: 1.23

Hopefully these examples can be reproduced and are enough to show what seems to not be working as expected (or much more documentation is needed, somewhere).
Comment 7 ady 2023-12-06 15:04:58 UTC
(In reply to ady from comment #6)
> Format:
> [NatNum12 capitalize EUR]\""Total: "\"0.00
> Actual result:
> "Total: "1.23
> Expected result:
> "Total: "One euro and twenty-three cents

Actually, considering the combination of backslash and quotation marks, I'm not even sure about the precise expected result anymore, but the number is surely not converted, so that's not working.
Comment 8 gmolleda 2023-12-06 17:21:01 UTC
Error since 6.1
Comment 9 ady 2023-12-06 18:08:13 UTC
(In reply to gmolleda from comment #8)
> Error since 6.1

The format was introduced in LO 6.1

https://wiki.documentfoundation.org/ReleaseNotes/6.1#Localization

So, either an implementation error, or the possibility is not supported (yet?).

FWIW, there are possible workarounds in terms of presentation, such as (for example, among others):
="Total: "&TEXT(1.23;"[NatNum12 cardinal]0.00")

That workaround needs an auxiliary cell, because the result of this cell (formula) is a text value, not a numeric value presented in text format.