Parsing a user-entered localized datetime

Denis Steckelmacher dsteckel at ulb.ac.be
Wed Apr 10 15:41:34 BST 2013


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.




More information about the kde-core-devel mailing list