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 735096 - Natural language is intermpreting day in a month wrong
Natural language is intermpreting day in a month wrong
Status: RESOLVED FIXED
Product: california
Classification: Other
Component: internationalization
master
Other Linux
: Normal normal
: 0.2.0
Assigned To: California Maintainers
California Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-20 12:08 UTC by Mattias Eriksson
Modified: 2014-08-22 22:57 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mattias Eriksson 2014-08-20 12:08:09 UTC
I'm attempted to write a string like "Appointment 11:00am 9/1", but with the Swedish translation enabled so it was: "Möte kl 11 1/9". 
The problem is as you see that we write day/month and not month/day, so this was interpreted as January 9, and not September 1 as I expected. 
So it would be nice if this could be made translatable also, 

Well actually there is a translation 
#. A "pretty" date abbreviated with no day of week or year according to locale preferences,
#. i.e. "3/10"
#. Leading zeroes will be stripped.
#. See http://www.cplusplus.com/reference/ctime/strftime/ for format reference
#: ../src/calendar/calendar.vala:181
#, no-c-format
msgid "%m/%d"
msgstr "%d/%m"

but that seems not to be used for the interpreter.
Comment 1 Jim Nelson 2014-08-21 23:32:17 UTC
Yes, the pretty date is used for display purposes only.  The Quick Add parser auto-detects the date ordering at startup and uses that.  If you run California like this:

$ G_MESSAGES_DEBUG=all california

You should see on the console a line that looks something like this:

Date ordering: MDY, separator: / (formatted=04/03/2001)

What does your say?
Comment 2 Mattias Eriksson 2014-08-22 06:37:49 UTC
Mine does say: 

Date ordering: YMD, separator: - (formatted=2001-04-03)

Which is correct, since we use YMD when we specify all three of them. Also note that the prefered separator is -, even though 2001/04/03 also is acceptable but not used as much. But then when we specify only month and day we use D/M, actually we sometimes use that with the year also but then we use different separators D/M-Y like 3/4-2001 is understood as third of april 2001. And I guess that the notation 3/4 ordering comes from natural language, third day of the fourth month.

Anyway, the date order YMD as is correct, but M/D is not there we use D/M. So I suggest to re-use the pretty date from the translation for that.
Comment 3 Jim Nelson 2014-08-22 22:57:52 UTC
I'm very resistant to using the pretty date formatter for parsing.  My experience has been that translators are more hesitant about manipulating strftime strings than normal strings.  Also, to rely on the pretty date formatter means that people using untranslated or partially-translated strings will wind up having to use American-style ordering.  This is frustrating since we can determine the ordering programmatically, translated or not.

I don't know that Quick Add will ever support something like 3/4-2001.  QA is not meant to be a perfect end-all always-correct parser; that's a tall order.  If enough people ask for it (or someone supplies a patch!) I'll certainly consider it.

I suspect day/month is common for most locales using YMD, so I've altered the parser to work that way.

Pushed to master, commit f7ee14