From kde-devel Fri Jun 13 11:02:16 2014 From: "Denis Steckelmacher" Date: Fri, 13 Jun 2014 11:02:16 +0000 To: kde-devel Subject: Re: Review Request 118448: Use KCalendarSystem to get the list of the month and day names that shoul Message-Id: <20140613110216.16370.88550 () probe ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-devel&m=140265738012426 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============6359582246317771002==" --===============6359582246317771002== Content-Type: multipart/alternative; boundary="===============0070591745163933192==" --===============0070591745163933192== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/118448/ ----------------------------------------------------------- (Updated June 13, 2014, 11:02 a.m.) Review request for Baloo, Localization and Translation (l10n) and Alexander Potashev. Changes ------- Factorize the two for loops and try to find two years, one leap year and one "normal" year, so that every month name can be found regardless of whether the current year is leap or not. Repository: baloo Description ------- The query parser made the erroneous assumption that each language uses at most one calendar system, and therefore used i18nc to translate the month and day names recognized by the parser. This patches changes that and uses the KCalendarSystem of the user to get the month and day names. I've written the code by looking at how the gregorian, hebrew and islamic calendars work (these are the three that I somehow understand). The idea is to try to get as many days and months as possible, by incrementing an index until the calendar system returns NULL strings. This works well for days, but monthName() requires a year, that is used by some calendar systems to rename/add months on leap years. I pass the current year, as most of the users will look for dates not too far in the future nor in the past. Is there a mean to get the complete list of month names and their corresponding number, using KCalendarSystem or anything else? Diffs (updated) ----- src/queryparser/pass_periodnames.h 1d7d522 src/queryparser/pass_periodnames.cpp da688ed Diff: https://git.reviewboard.kde.org/r/118448/diff/ Testing ------- The query parser testsuite still passes, and properly gets the name of Gregorian months and days (the tests run using the C locale). Thanks, Denis Steckelmacher --===============0070591745163933192== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit
This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/118448/

Review request for Baloo, Localization and Translation (l10n) and Alexander Potashev.
By Denis Steckelmacher.

Updated June 13, 2014, 11:02 a.m.

Changes

Factorize the two for loops and try to find two years, one leap year and one "normal" year, so that every month name can be found regardless of whether the current year is leap or not.
Repository: baloo

Description

The query parser made the erroneous assumption that each language uses at most one calendar system, and therefore used i18nc to translate the month and day names recognized by the parser. This patches changes that and uses the KCalendarSystem of the user to get the month and day names.

I've written the code by looking at how the gregorian, hebrew and islamic calendars work (these are the three that I somehow understand). The idea is to try to get as many days and months as possible, by incrementing an index until the calendar system returns NULL strings. This works well for days, but monthName() requires a year, that is used by some calendar systems to rename/add months on leap years. I pass the current year, as most of the users will look for dates not too far in the future nor in the past. Is there a mean to get the complete list of month names and their corresponding number, using KCalendarSystem or anything else?

Testing

The query parser testsuite still passes, and properly gets the name of Gregorian months and days (the tests run using the C locale).

Diffs (updated)

  • src/queryparser/pass_periodnames.h (1d7d522)
  • src/queryparser/pass_periodnames.cpp (da688ed)

View Diff

--===============0070591745163933192==-- --===============6359582246317771002== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --===============6359582246317771002==--