Bug 128159 - Built-in cross references lose their "reference type" if opened or edited with LibreOffice in different "User Interface" language than originally created
Summary: Built-in cross references lose their "reference type" if opened or edited wit...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.4.7.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Fields-Cross-Reference
  Show dependency treegraph
 
Reported: 2019-10-15 18:19 UTC by Marcelo
Modified: 2020-06-17 06:34 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file. Created in LibreOffice version 5.4.7.2, en-US interface. (14.69 KB, application/vnd.oasis.opendocument.text)
2020-06-16 14:35 UTC, Marcelo
Details
Example file. Created in LibreOffice version 6.4.4.2, en-US interface. (15.39 KB, application/vnd.oasis.opendocument.text)
2020-06-16 18:00 UTC, Marcelo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcelo 2019-10-15 18:19:28 UTC
Description:
This happened when another person reviewed a document I had written, and said all figures had lost their reference type.
When I created the document in LibreOffice Writer with English user interface, I had to create a 'custom' number range because the document was in Portuguese, and I had many figures - so, a number range "Figura" and many cross references to "Figura". Those cross references use the type "Category and Number" to show, say, "Figura 1".
At the review, the person reported that "Figura 1" was actually showing just "1". I reopened the file in my computer, and everything was normal.
So, I tried switching LO user interface to Portuguese, just to see if that happened. Bingo - no "Figura 1", just "1". I even tried fixing it, modifying every field in the document, changing any "Illustration" range to "Figura", but the problem persists if the document is opened in another user interface language.

Steps to Reproduce:
0. LibreOffice user interface in, e.g., English (USA)
1. New document (or any document with built-in number ranges);
2. Insert caption - use any built-in number range (e.g. "Illustration");
3. Insert cross-reference to captioned item, using style "Category and Number" (located in "Insert Reference to" dropdown);
4. Save;
5. Change LibreOffice user interface (e.g. Portuguese - Brazilian);
6. Open document saved in step 4;
7. Press space in front of that reference.


Actual Results:
Although the document looks fine when you open it, after you modify anything in it, the cross-reference category disappears. If there where any other cross-ref to other built-in styles, all of then disappear. 

Expected Results:
No change in cross-references.


Reproducible: Always


User Profile Reset: No



Additional Info:
Built-in style "Figure" doesn't seen to be affected by this bug on version 5.4.7.2 - it is affected in version 6.1.6.3.

Tested in (portable version):
Version: 5.4.7.2
Build ID: c838ef25c16710f8838b1faec480ebba495259d0
CPU threads: 4; OS: Windows 6.2; UI render: GL; 
Locale: pt-BR (pt_BR); Calc: group

First noticed in (installed version):
Version: 6.1.6.3 (x64)
Build ID: 5896ab1714085361c45cf540f76f60673dd96a72
CPU threads: 4; OS: Windows 10.0; UI render: default; 
Locale: pt-BR (pt_BR); Calc: CL
Comment 1 Buovjaga 2020-04-26 13:14:22 UTC
(In reply to Marcelo from comment #0)
> Additional Info:
> Built-in style "Figure" doesn't seen to be affected by this bug on version
> 5.4.7.2 - it is affected in version 6.1.6.3.

Do you mean that files created with 5.4.7 or older are immune to this bug even when opened in a newer version?

Please attach an example document.
Set to NEEDINFO.
Change back to UNCONFIRMED after you have provided the document.
Comment 2 Marcelo 2020-06-16 14:06:30 UTC
(In reply to Buovjaga from comment #1)

> Do you mean that files created with 5.4.7 or older are immune to this bug
> even when opened in a newer version?
 
No, unfortunately not. I tried creating a new writer document with the previous version, as you asked, but it still loses the cross-reference category when opened in 6.1.6.3.
And actually, it's the other way around: I didn't notice, but "Figure" is not a built-in style in version 5.4.7 - and that is why you don't lose the cross-reference category text if you create the file with version 6 and open it in version 5.

What seems to be the case is that LibreOffice enforces built-in styles based on it's "interface language", not the "document language" - and that's why you lose the cross-ref category when you try to edit it in another LibreOffice language.

I will create an example file and upload it.
Comment 3 Marcelo 2020-06-16 14:35:02 UTC
Created attachment 162059 [details]
Example file. Created in LibreOffice version 5.4.7.2, en-US interface.

As promised, I created an example file for you. LibreOffice version 5.4.7.2, en-US interface.

Another interesting thing: I created a custom category based on the built-in name of the Portuguese version, Figura (which translates to "Illustration" in that same version, en-US interface), and did the same instructions as my original question. Guess what: not only did it it lose the category of the cross-reference, it also updated the "custom" category (for the en-US interface) 'Figura' count. The last "Figura 1" was updated to "Figura 2".
I also tried opening the file in LibreOffice version 6.1.6.3, but, since the new built-in equivalent of pt-BR "Figura" is the en-US "Figure", it didn't update the "Figura" count, but at least it didn't lose the category of the cross-ref.
Comment 4 Buovjaga 2020-06-16 16:59:55 UTC
(In reply to Marcelo from comment #3)
> Created attachment 162059 [details]
> Example file. Created in LibreOffice version 5.4.7.2, en-US interface.

Wow, yeah that is super weird. Basically any change makes the category name disappear, when opened with a non-en-US UI language.

However, when I tried building something from scratch based on your steps in the description (using Illustration), I could not create such a problematic document.

Are you able to create such broken documents with version 6.4.x?

Tested with
Arch Linux 64-bit
Version: 7.1.0.0.alpha0+
Build ID: 43bdac0ebd65dfc32a0b8cf2c42fde88ad585e3f
CPU threads: 8; OS: Linux 5.7; UI render: default; VCL: kf5
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 15 June 2020
Comment 5 Marcelo 2020-06-16 18:00:07 UTC
Created attachment 162069 [details]
Example file. Created in LibreOffice version 6.4.4.2, en-US interface.

(In reply to Buovjaga from comment #4)
> Are you able to create such broken documents with version 6.4.x?

Yup. And I also tried building another document from scratch (attached), with all possible categories of pictures, but the same thing happens - one minor edition and poof, every cross-ref category disappears. The version I used is a portable one:
Version: 6.4.4.2 (x86)
Build ID: 3d775be2011f3886db32dfd395a6a6d1ca2630ff
CPU threads: 4; OS: Windows 10.0 Build 16299; UI render: GL; VCL: win; 
Locale: pt-BR (pt_BR); UI-Language: en-US
Calc: threaded

I was using 6.1.6.3 because it's the last approved version in my company - other than this, only portable versions are usable, such as that one.


To be fair, I don't know if there is a solution for that problem.
Comment 6 Buovjaga 2020-06-16 18:42:56 UTC
Argh, sorry, I failed in my reproduction initially: I did not notice I have to press space in the same paragraph where the reference is.
Comment 7 Marcelo 2020-06-16 20:05:29 UTC
(In reply to Buovjaga from comment #6)
> Argh, sorry, I failed in my reproduction initially: I did not notice I have
> to press space in the same paragraph where the reference is.

No problems =)
I think I get what happened: pressing Enter in front of the cross-ref, or editing any other line that *do not* have any cross-ref doesn't make they disappear.

Also, trying to add any new cross-ref in the new UI language also makes the previous ones go poof (yeah, noticed this right now).