Bug 99236

Summary: FILEOPEN Date field shows date in English while it should show it in the document's original language.
Product: LibreOffice Reporter: jackolantern
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED FIXED    
Severity: enhancement CC: cno, documentfoundation, ilmari.lauhakangas, jluth, kelemeng, leandroknorre, libreoffice, martijn
Priority: medium Keywords: filter:docx, preBibisect
Version: 3.5.0 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=115780
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 112969    
Attachments: Word 2016 document with date field
Word 2007 document with date field

Description jackolantern 2016-04-12 07:11:56 UTC
Created attachment 124268 [details]
Word 2016 document with date field

I have a Word 2016 docx document in a Dutch Word 2016. I inserted a date field into that document to show me the Dutch date.When I open the docx file in Writer it shows the date in English.
Comment 1 Buovjaga 2016-04-24 17:19:00 UTC
Confirmed.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.2.0.0.alpha1+
Build ID: 334599030e7b45153107a3075f9049a7463aac80
CPU Threads: 8; OS Version: Linux 4.5; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)
Built on April 22nd 2016
Comment 2 Cor Nouws 2016-12-02 12:32:16 UTC
the same in 3.6.7
3.3.4 shows "2-12-16"
Comment 3 Buovjaga 2016-12-16 21:09:44 UTC
*** Bug 104697 has been marked as a duplicate of this bug. ***
Comment 4 Leandro Knorre 2017-08-30 19:08:10 UTC
same happens to me in Portuguese, version 5.4.0.3
Comment 5 Leandro Knorre 2017-08-30 19:12:51 UTC
Created attachment 135881 [details]
Word 2007 document with date field
Comment 6 Martijn van de Streek 2018-02-16 15:18:49 UTC
*** Bug 115780 has been marked as a duplicate of this bug. ***
Comment 7 Gabor Kelemen (allotropia) 2019-01-28 08:30:40 UTC
*** Bug 122935 has been marked as a duplicate of this bug. ***
Comment 8 Buovjaga 2019-01-28 10:53:03 UTC
To quote myself from the duplicate: "It has been like this since it started working in 5.0. Version 4.4 and older do not save the date or date field."
Comment 9 Adam Kovacs 2019-02-14 12:47:46 UTC
(How to reproduce)
Writer:
Insert, Field, Date
Word:
Insert, Modules, Field, Date
Comment 10 Adam Kovacs 2019-02-14 13:20:33 UTC
This could be related source code:
https://opengrok.libreoffice.org/xref/core/oox/source/drawingml/textfield.cxx?r=c6e5d551#58
Comment 11 Cor Nouws 2019-02-15 09:07:36 UTC
(In reply to Buovjaga from comment #8)
> To quote myself from the duplicate: "It has been like this since it started
> working in 5.0. Version 4.4 and older do not save the date or date field."

Are you sure that the problem is on saving?

When I open http://bugs.documentfoundation.org/attachment.cgi?id=124268 today in 

3.3.0.4    I see    15-02-19       (which is OK in Dutch)
63-master  I see    Friday 15 February 2019   (is no Dutch)
Comment 12 Buovjaga 2019-02-15 11:36:43 UTC
(In reply to Cor Nouws from comment #11)
> (In reply to Buovjaga from comment #8)
> > To quote myself from the duplicate: "It has been like this since it started
> > working in 5.0. Version 4.4 and older do not save the date or date field."
> 
> Are you sure that the problem is on saving?
> 
> When I open http://bugs.documentfoundation.org/attachment.cgi?id=124268
> today in 
> 
> 3.3.0.4    I see    15-02-19       (which is OK in Dutch)
> 63-master  I see    Friday 15 February 2019   (is no Dutch)

3.3.0 saves the date as plain text, yes, but not as field (my "or date field" condition).
Comment 13 Cor Nouws 2019-02-15 19:30:20 UTC
(In reply to Buovjaga from comment #12)

> 3.3.0 saves the date as plain text, yes, but not as field (my "or date
> field" condition).
But a docx with such a field, shows at least Dutch formatted date in 3.3.0 and not in master. Or do I miss something?
Comment 14 Buovjaga 2019-02-15 19:43:45 UTC
(In reply to Cor Nouws from comment #13)
> (In reply to Buovjaga from comment #12)
> 
> > 3.3.0 saves the date as plain text, yes, but not as field (my "or date
> > field" condition).
> But a docx with such a field, shows at least Dutch formatted date in 3.3.0
> and not in master. Or do I miss something?

Ok, let's call it preBibisect. I noticed the fieldness is present in 3.5.0 (English date).
Comment 15 QA Administrators 2021-03-11 04:48:10 UTC Comment hidden (obsolete)
Comment 16 Hagar Delest 2021-04-28 18:43:11 UTC
Still present in:
Version: 7.1.2.2 / LibreOffice Community
Build ID: 10(Build:2)
CPU threads: 8; OS: Linux 5.11; UI render: default; VCL: x11
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Ubuntu package version: 1:7.1.2~rc2-0ubuntu2
Calc: threaded
Comment 17 Justin L 2021-07-13 07:20:29 UTC
I assume we are talking about
<w:r>
  <w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r>
  <w:instrText xml:space="preserve"> DATE \@ "dddd d MMMM yyyy" \* MERGEFORMAT
  </w:instrText>
</w:r>
<w:r>
  <w:fldChar w:fldCharType="separate"/>
</w:r>
<w:r w:rsidR="00B124D3">
  <w:rPr>
    <w:noProof/>
  </w:rPr>
  <w:t>dinsdag 15 maart 2016</w:t>
</w:r>
<w:r>
  <w:fldChar w:fldCharType="end"/>
</w:r>

So, if you don't know about date fields (and LO 3.5 already does know), then you will just display the string of text (which is neither a date, nor Dutch, but just a string of characters) and it will be "perfect".

So this looks like an enhancement request. In LO, the field has a language setting attached to it, instead of just pulling the language from the paragraph character properties. So the importer probably has to be smart enough to find the current language setting and apply it to the imported date field.
Comment 18 Cor Nouws 2021-07-14 06:34:15 UTC
(In reply to Justin L from comment #17)
> So, if you don't know about date fields (and LO 3.5 already does know), then
> you will just display the string of text (which is neither a date, nor
> Dutch, but just a string of characters) and it will be "perfect".
> 
> So this looks like an enhancement request. In LO, the field has a language
> setting attached to it, instead of just pulling the language from the
> paragraph character properties. So the importer probably has to be smart
> enough to find the current language setting and apply it to the imported
> date field.
Makes sense. Thanks for the insight.
Comment 19 Justin L 2022-03-14 08:30:00 UTC
*** Bug 137610 has been marked as a duplicate of this bug. ***
Comment 20 Justin L 2022-05-03 14:45:41 UTC
This (and the duplicates) are fixed in LO 7.4 with 
commit 115599cc3478e37879cd2fa0b6c6c9dabde7dfd1
Author: Justin Luth on Sat Apr 9 18:06:24 2022 +0200
    tdf#132475 writerfilter: use proper date-field defaults