After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 33229 - German locale and date input
German locale and date input
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: GUI
git master
Other All
: Normal normal
: ---
Assigned To: Morten Welinder
Jody Goldberg
: 65045 119904 139932 167279 370458 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2000-11-25 19:46 UTC by mj
Modified: 2010-03-28 18:51 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Proposed goffice patch (664 bytes, patch)
2008-09-20 17:57 UTC, J.H.M. Dassen (Ray)
none Details | Review
Proposed gnumeric patch (2.68 KB, patch)
2008-09-20 18:00 UTC, J.H.M. Dassen (Ray)
none Details | Review
Goffice patch (5.94 KB, patch)
2009-03-15 23:02 UTC, Morten Welinder
none Details | Review
Updated patch (6.12 KB, patch)
2009-03-18 20:42 UTC, Morten Welinder
none Details | Review
Updates patch (6.47 KB, patch)
2009-03-19 20:51 UTC, Morten Welinder
none Details | Review
Updated patch (8.15 KB, patch)
2009-03-19 23:27 UTC, Morten Welinder
none Details | Review
Updated patch (8.18 KB, patch)
2009-03-20 15:54 UTC, Morten Welinder
none Details | Review

Description mj 2001-01-27 17:33:27 UTC
Package:  gnumeric
Severity: normal
Version:  0.58
Synopsis: gnumeric - German locale and date input
Class:    sw-bug

Distribution: Red Hat Linux release 6.2 (Zoot)
System: Linux 2.2.17 i686 unknown
C library: glibc-2.1.3-21
C compiler: egcs-2.91.66
glib: 1.2.8
GTK+: 1.2.8
ORBit: ORBit 0.5.4
gnome-libs: gnome-libs 1.2.8
libxml: 1.8.10
gnome-print: gnome-print-0.25
gnome-core: gnome-core 1.2.4


Description:
When gnumeric 0.58 runs with the German locale (LANG=de_DE),
it isn't possible to input dates in the normal German DD.MM.YY or
DD.MM.YYYY format. Any date strings are only treated as text cells.
The formats are missing a dd\.mm\.yyyy format, too.

Martin




------- Bug moved to this database by debbugs-export@bugzilla.gnome.org 2001-01-27 12:33 -------
This bug was previously known as bug 33229 at http://bugs.gnome.org/
http://bugs.gnome.org/show_bug.cgi?id=33229
Originally filed under the Gnumeric product and general component.

The original reporter (mj@m-j-s.net) of this bug does not have an account here.
Reassigning to the exporter, debbugs-export@bugzilla.gnome.org.
Reassigning to the default owner of the component, jgoldberg@home.com.

Comment 1 Jody Goldberg 2001-01-27 21:26:46 UTC
We currently hard code the date seperator because there is no obvious 
way to extract it from the locale.  If anyone has ideas it is an easy 
fix.
Comment 2 Jody Goldberg 2002-02-08 02:43:23 UTC
*** Bug 65045 has been marked as a duplicate of this bug. ***
Comment 3 Andreas J. Guelzow 2002-04-11 18:59:10 UTC
If we can't extract it from the locale, can we make it a preference
setting?
Comment 4 Jody Goldberg 2002-10-14 05:30:01 UTC
I'd like to see this resolved but don't see a clean way to do it.
Having a preference setting seems like a kludge because it would be gnumeric
specific and hidden.  We'll face the same problem with currencies.

As soon as we stop using the locales, we'll need a system wide mechanism for
configuring and replacing it.
Comment 5 Morten Welinder 2002-10-14 14:57:33 UTC
We could extract it from a translation of a string like
"12/31/2002" [US] which might be "31.12.2002" [DE].
Comment 6 Jody Goldberg 2002-10-14 16:26:33 UTC
That is even worse than a preference setting.  We'd be creating a magic
preference setting defined via the translation that is specific to gnumeric.
Comment 7 Andreas J. Guelzow 2002-10-14 18:10:15 UTC
What about scanning the output of 
date +%x
for an appropriate separator? 
in german:
14.10.2002

in english:
10/14/2002
Comment 8 Christian Rose 2002-10-15 14:12:16 UTC
The following little C proram returns the locale's date format:

/* start */
#define _GNU_SOURCE
#include <langinfo.h>
#include <locale.h>

int
main (void)
{
  unsigned char time_string[80];

  setlocale (LC_ALL, "");
  strcpy (time_string, nl_langinfo(D_FMT));
  printf ("%s\n", time_string);
  return 0;
}
/* end */

Perhaps this could be used for constructing the appropriate default
date format for the locale. If the locale has no date format defined
or nl_langinfo can't be used, I suggest the ISO date format is used by
default in those cases instead
(http://www.cl.cam.ac.uk/~mgk25/iso-time.html).
Comment 9 Jody Goldberg 2002-10-15 14:15:34 UTC
Yes that is known we're already pretending to parse it to guess
day-month vs month-day.  We're going to need to parse even more of it to guess
the default seperator.
Comment 10 Andreas J. Guelzow 2003-08-14 20:21:26 UTC
*** Bug 119904 has been marked as a duplicate of this bug. ***
Comment 11 Andreas J. Guelzow 2004-04-13 21:34:55 UTC
*** Bug 139932 has been marked as a duplicate of this bug. ***
Comment 12 Andreas J. Guelzow 2006-11-06 06:50:10 UTC
*** Bug 370458 has been marked as a duplicate of this bug. ***
Comment 13 Morten Welinder 2006-11-08 00:55:33 UTC
Currently Gnumeric will understand "24.12.2006" as a date as long as...

1. the cell into which it is entered has been formatted as a date with
   day before month.

-or-

2. the locale has day before month, and the cell is *not* using a month-
   before-day format such as "m/d/y".

That pretty much means that input works as expected.

What is missing is that if you select a "dd.mm.yyyy" format (as a custom
format, for now), you will hit bug 371351 and things will look wrong.

Also missing is the right format in the Date part of the menu.
Comment 14 J.H.M. Dassen (Ray) 2008-09-20 17:57:48 UTC
Created attachment 119045 [details] [review]
Proposed goffice patch

Use go_locale_get_date_format to provide the first format in the list of date formats.
Comment 15 J.H.M. Dassen (Ray) 2008-09-20 18:00:13 UTC
Created attachment 119046 [details] [review]
Proposed gnumeric patch

Use the format identified by go_locale_get_date_format for date editing.
Retain the day/month separator character the user used when processing date input.
Comment 16 Morten Welinder 2009-03-12 20:04:58 UTC
Bringing this back on the radar.
Comment 17 Morten Welinder 2009-03-13 17:05:46 UTC
Re. the src/gnm-format.c change:

1. If a cell has a format like yyyy-mm-dd, it gets very confusing if the
   editing format overrides that.

2. The result from go_locale_get_date_format is not necessarily suited for
   editing.  It is meant for display.  We really don't want weekdays or
   fully spelled-out month names for editing.
Comment 18 Morten Welinder 2009-03-13 17:11:42 UTC
Re. the goffice patch:

I am fairly certain that the correct format to use is "[-$f800]whatever",
i.e., a format that magically adapts to the users locale.  (Note, that
f800 is defined in terms of go_locale_get_date_format, see go-format.c)

Unlike Excel, I doubt we want to display that monstrosity in dialogs.
Comment 19 Morten Welinder 2009-03-13 17:23:01 UTC
Re. the number-match.c patch:

This will try to free some constant strings.  Apart from that, this part
of the patch can probably go in without waiting for the other parts.

I'll deal with it.
Comment 20 Morten Welinder 2009-03-13 19:01:20 UTC
number-match patch -- somewhat different from the one above -- is in.
It should be a no-op for locales that use slashes.
Comment 21 Morten Welinder 2009-03-14 02:18:58 UTC
Before we really start mucking with the dates in goffice, we need to make
Gnumeric stop looking at them directly.  Filed bug 575317 for that.
Comment 22 Morten Welinder 2009-03-14 22:46:12 UTC
Date editing now also uses the locale separator.  That ought to finish the
Gnumeric part (not counting bug 575317 and whatever sum1 will come up with).

Leaving open for the goffice part.
Comment 23 Morten Welinder 2009-03-15 23:02:31 UTC
Created attachment 130716 [details] [review]
Goffice patch

This somewhat brutal patch cuts down on the number of date formats in the
dialog.  Further, it makes sure localized dates are present.

Comments are most welcome.
Comment 24 Jon Kåre Hellan 2009-03-16 20:01:11 UTC
Looks like some unwanted interaction with locale's decimal separator.

For nb_NO.UTF-8, I get commas where there should be periods.

dd,mm,yyyy etc.
Comment 25 Morten Welinder 2009-03-16 23:23:45 UTC
Hmm...  This is at least partly on purpose.  The format is guess really
is "dd.mm.yyyy".

"dd.mm.yyyy" gets localized as "dd,mm,yyyy" and we display that.
Note, that you actually get dots when you use that format.

Excel might not localize those dots.  I'll have to check.
Comment 26 Morten Welinder 2009-03-16 23:32:11 UTC
Relatedly, 1-Jan-2000 [us] displays as 1-jan.-2000 in d-mmm-yyyy format.
Note the dot.  da_DK has just 1-jan-2000.

Is that really how people write it in nb_NO?  Currently we do not even
accept 1-jan-2000 as input which is just plain evil.
Comment 27 Morten Welinder 2009-03-16 23:41:24 UTC
Such punctuation is now optional on entry.  Aka 1-jan-2000 is now a fine
thing to enter.
Comment 28 Jon Kåre Hellan 2009-03-17 06:34:33 UTC
> 1-Jan-2000 [us] displays as 1-jan.-2000 in d-mmm-yyyy format.
> Note the dot. Is that really how people write it in nb_NO?

No, they don't. But I've never seen hyphens and month names together at all.
Hyphens are only used with the ISO 8601 format:  2000-01-01.

With month names, you may see

1. mars 2000 - unabbreviated month
1. jan. 2000 - abbreviated month
Always with day written as ordinal ("first"), indicated by period.
Comment 29 Jon Kåre Hellan 2009-03-17 10:39:09 UTC
> "dd.mm.yyyy" gets localized as "dd,mm,yyyy" and we display that.
> Note, that you actually get dots when you use that format.

> Excel might not localize those dots.  I'll have to check.

I don't understand why anybody would want to localize them. In the dialog, the user sees dd,mm,yyyy, which is wrong. In the cell, he gets 25.8.1958, which is
probably what he wants. This is confusing.
Comment 30 Morten Welinder 2009-03-17 18:38:06 UTC
Localization has been improved.

The problem was that we did not distinguish between dots that were decimal
points and dots that were not.  We not localize "dd.mm.yyyy mm:mm:ss.000"
into "dd.mm.yyyy mm:mm:ss,000".  Note the different treatment of dots.
Comment 31 Morten Welinder 2009-03-18 20:42:14 UTC
Created attachment 130919 [details] [review]
Updated patch

This adds the f800 format.  (The dialog shouldn't show the code directly,
but that's a different problem.)
Comment 32 Morten Welinder 2009-03-19 20:51:49 UTC
Created attachment 130989 [details] [review]
Updates patch

This patch adds more magic formats.
Comment 33 Morten Welinder 2009-03-19 23:27:28 UTC
Created attachment 131000 [details] [review]
Updated patch

This patch takes care of time formats too.
Comment 34 Morten Welinder 2009-03-20 15:54:51 UTC
Created attachment 131035 [details] [review]
Updated patch

This adds the magic date/time format.
Comment 35 Morten Welinder 2009-03-20 16:54:49 UTC
*** Bug 167279 has been marked as a duplicate of this bug. ***
Comment 36 Morten Welinder 2009-09-25 01:11:33 UTC
I think this has been completely resolved by now.  If not, please open
a new bug with whatever is left -- I have lost track.
Comment 37 Steve White 2010-03-28 12:57:04 UTC
Hi,

I am looking at Gnumeric 1.10.1 on Ubuntu 10.4 Beta.
Should the fix be in this version?  
Then I don't see it.

In the Format Cells dialog, don't see a Date format anything like the usual German
   dd.mm.yy

Do I have to set a locale first?  But why?
What locale exactly needs to be set?

In KDE, I set the Region & Language "Short date format" to DD.MM.YYYY.
No luck.

Cheers!
Comment 38 Morten Welinder 2010-03-28 18:51:24 UTC
Start Gnumerc in German locale:

    LANG=de_DE.UTF-8 gnumeric

(I have no idea what KDE's setting is connected to, but it would appear that
it is not the standard thing.)

With this I see "dd.mm.yyyy" as the 4th option.  The first three as the
special "[$...]..." codes that change depending on what locale they are
used in.