[SailfishDevel] Add locale support to jolla calendar

E.S. Rosenberg es.rosenberg+sailfishos.org at gmail.com
Mon Jan 19 20:42:09 UTC 2015

Here is a more decent patch (in the unified format) I redid the code after
update10 instead of trying to apply the patches, though I expect it all
came out more or less the same...

The patch can now also be found here:

Just one thing, I'm not the biggest expert on patch, should I remove the
.orig/.update10 in the patch so that both pathes are the original file?


2014-11-16 15:45 GMT+02:00 E.S. Rosenberg <
es.rosenberg+sailfishos.org at gmail.com>:

> 2014-11-14 13:51 GMT+02:00 Pekka Vuorela <pekka.vuorela at jolla.com>:
>> to, 2014-11-13 kello 23:43 +0200, E.S. Rosenberg kirjoitti:
>> > Well I solved it and now it's dependent on the locale (which by
>> > default is not set on Jolla) so:
>> > 1. I am more then happy to submit my patches to Jolla, though you guys
>> > claim 'closed source' every file I edited had a BSD license at the
>> > top.
>> I expect you have been checking Silica files. There the QML file side
>> does have BSD licenses on files. Rationale being to allow application
>> developers taking snippets of code when using provided elements directly
>> is not enough for some reason.
>> I don't think we have a precedent of merging contributions there,
>> though. So while it's great you got it working how you like, it could be
>> easier for us (or me) right now to implement this separately.
>> > 2. To actually make this work properly jolla one or all of the
>> > following environment variables need to be present LC_TIME, LC_ALL,
>> > LANG, by default LANG is present but for people like me who want
>> > language A but locale B for dates etc. so some way to set LC_* or at
>> > least LC_ALL would be cool.
>> > I tried adding to my .bashrc but that had no effect for launching from
>> > the launcher, from CLI it helpend of course.
>> >
>> > I assume I need to add it somewhere in dconf but I'm not knowledgeable
>> > enough about dconf for the moment...
>> User session picks up the locale values (that is, LANG at the moment
>> set) from /var/lib/environment/nemo/locale.conf
>> But having different locale categories working properly is not that
>> simple. String translations are also used for date/time patterns, Qt
>> knows only one system locale, etc.
> Are you sure about this, as far as I can tell it's working fine, Qt is one
> of those frameworks that handles locales really well....
>> Acknowledged that some people want this, though.
>> > Should I publish the patches here or is that considered unacceptable
>> > behavior on this list?
>> I see no reason not to.
> So here are the patches, they will help you implement it.
> /usr/lib/qt5/qml/Sailfish/Silica/DatePickerDialog.qml -- haven't gone over
> the whole file.
> I am not 100% sure the DatePickerDialog.qml patch is needed for the
> calendar fix, but I guess for other uses....
> Modified start date of labels and added Qt.locale().firstDayOfWeek into
> the calculation.
> /usr/lib/qt5/qml/Sailfish/Silica/private/DatePicker.js -- this file does
> all the work
> removed variable _weekStartsOnMonday
> added variable _firstDayOfWeek
> added function _setFirstDayOfWeek(dayNo)
> modified function _getStartDateForMonthView(year, month) -- modified the
> math of the function so that it now always gives the right date (no matter
> what the firstDayOfWeeks' value is) and therefor the exception set for
> Monday was commented out.
> /usr/share/jolla-calendar/pages/MonthPage.qml -- the QML file that
> describes the jolla-calendar page that matters
> Modified start date of labels and added Qt.locale().firstDayOfWeek into
> the calculation.
> /usr/lib/qt5/qml/Sailfish/Silica/DatePicker.qml
> added property firstDayOfWeek which calls
> DatePicker.js._setFirstDayOfWeek() -- this was the only way I know at the
> moment to pass the information known to Qt.locale to the javascript, there
> may be better ways.
> As said everything was checked in locales with the 3 different week starts
> that exist according to wikipedia (sat, sun, mon), but it should work for
> any day so unless someone decides that s/he observes the calendar of
> Discworld (8 days/week) it should be fine.
> The order of the files in diff was "diff new orig".
> A mention of me in the source would be nice, but not mandatory.
> Hope this helps you implement it...
> Eli
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to
>> devel-unsubscribe at lists.sailfishos.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150119/a82cd9fe/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jolla-calendar.patch
Type: text/x-patch
Size: 4564 bytes
Desc: not available
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150119/a82cd9fe/attachment-0001.bin>

More information about the Devel mailing list