<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Patryk Zawadzki &#187; l10n</title>
	<atom:link href="http://blogs.gnome.org/patrys/tag/l10n/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.gnome.org/patrys</link>
	<description>Tales of a whining gnome</description>
	<lastBuildDate>Mon, 14 Mar 2011 01:23:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/pl/</creativeCommons:license>		<item>
		<title>How to determine the first day of week</title>
		<link>http://blogs.gnome.org/patrys/2008/09/29/how-to-determine-the-first-day-of-week/</link>
		<comments>http://blogs.gnome.org/patrys/2008/09/29/how-to-determine-the-first-day-of-week/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 13:25:48 +0000</pubDate>
		<dc:creator>patrys</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Project Hamster]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[locale]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/patrys/?p=15</guid>
		<description><![CDATA[Today we got a report for bug #554256 in Hamster. The first day of week was reported as Sunday for some locales that certainly used Monday. I did some research and found that before Hamster relied on a simple check to determine the result: Run locale first_weekday (by the way, we have to use os.popen [...]]]></description>
			<content:encoded><![CDATA[<p>Today we got a report for <a href="http://bugzilla.gnome.org/show_bug.cgi?id=554256">bug #554256</a> in Hamster. The first day of week was reported as Sunday for some locales that certainly used Monday. I did some research and found that before Hamster relied on a simple check to determine the result:</p>
<ul>
<li>Run <code>locale first_weekday</code> (by the way, we have to use <code>os.popen</code> here as these don&#8217;t seem to be accessible from Python)</li>
<li>If the result is 1, use Sunday, else use Monday (literally, it would treat 2 and 6 as Monday)</li>
</ul>
<p>That seemed to work at least for some countries but was wrong which became apparent when more people started using Hamster (and to put myself in shame: I didn&#8217;t notice this before but it was also broken for me). It seems the correct version is:</p>
<ul>
<li>Run <code>locale first_weekday week-1stday</code></li>
<li>Parse <code>week-1stday</code> as date with <code>%Y%m%d</code></li>
<li>Move the result <code>first_weekday - 1</code> days forward</li>
<li>Check the weekday of the result</li>
</ul>
<h3>Rationale:</h3>
<p>While <code>locale</code> manual pages are horribly outdated, all web searches point to <code>week-1stday</code> as the beginning of the first week of tracked Unix time. <code>first_weekday</code> is the 1-based offset of that week&#8217;s start day. It seems it&#8217;s only there so you can specify <code>first_weekday=2</code> and <code>first_workday=1</code> for the rare cases where working days span across two weeks.</p>
<p>Please do correct me if this is wrong as all of the above are assumptions based on glibc code and Google results. Hope the above helps someone in the future.</p>
<p><strong>Update:</strong> vuntz was kind enough to point me to <code>gtkcalendar.c</code>, part of GTK+. It does the same thing described above so it seems the method is correct.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/patrys/2008/09/29/how-to-determine-the-first-day-of-week/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blogs.gnome.org/patrys/tag/l10n/feed/ ) in 1.62505 seconds, on Feb 10th, 2012 at 2:35 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 10th, 2012 at 3:35 pm UTC -->
