DevHeads.net

Parsing a user-entered localized datetime

Hi,

I am a student applying for this year's Google Summer of Code, to work
on
Nepomuk. The project that interests me is a real "query parser" for
user-entered
search queries. For instance, the user can use Dolphin to find
documents created
"one year ago", containing "KDE and openSuSE", or having a certain tag.

I have already some spare time to work on this project and I want to
begin
investigating some of the problems I will face during the summer. One
of them is
parsing a user-entered datetime, like in the example above. A quick
search on
the KDE and Qt documentation pointed me to KCalendarSystem::readDate.
Unfortunately, this method does not seem to be able to parse
"difficult"
datetimes, for instance "last monday on 8:45" or "this morning".

Is there any class that I have missed and that does something like that
? If
there isn't any, where could I contribute this kind of parser (in a
separate
class in KDE Libs or by extending KCalendarSystem::readDate) ? I have
already
some ideas about how I could implement it, but I am still thinking
about how to
allow translators to provide locale-specific parsing rules. It can be a
simple
translation of "X days ago" in another language, or even parsing rules
adapted
to other calendar systems. Does KDE store its locale-specific settings
in files
that can be easily edited by translators ?

My native language is French, so I can ensure that the parser will be
able to
parse English and French dates, but I don't know any calendar system
other than
the Gregorian one.

Denis Steckelmacher.

Comments

Re: Parsing a user-entered localized datetime

By Kevin Krammer at 04/11/2013 - 12:03

Hi Denis,

Can't help you with the rest, but one example of locale specific settings are
(street-)address formatting rules.
You can find those files in kde-runtime/l10n, lool for config key
AddressFormat in the entry.desktop files for various locales.

Cheers,
Kevin