<?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/"
	>

<channel>
	<title>whump.com &#124; More Like This WebLog &#187; localization</title>
	<atom:link href="http://www.whump.com/moreLikeThis/tag/localization/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.whump.com/moreLikeThis</link>
	<description>Where is their vote?</description>
	<lastBuildDate>Mon, 28 Dec 2009 04:55:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Parsing Localized Strings in JavaScript</title>
		<link>http://www.whump.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.whump.com%2FmoreLikeThis%2F2004%2F09%2F10%2F04064%2F&amp;seed_title=Parsing+Localized+Strings+in+JavaScript</link>
		<comments>http://www.whump.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.whump.com%2FmoreLikeThis%2F2004%2F09%2F10%2F04064%2F&amp;seed_title=Parsing+Localized+Strings+in+JavaScript#comments</comments>
		<pubDate>Fri, 10 Sep 2004 07:00:00 +0000</pubDate>
		<dc:creator>Bill Humphries</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[localization]]></category>

		<guid isPermaLink="false">http://www.whump.com/moreLikeThis/2004/09/10/04064/</guid>
		<description><![CDATA[Now I discover (well, the testers discover) JavaScript does not take locale into consideration when attempting to parse a float.
So if you&#8217;re localized to Belgium, then parseFloat ('134,39') returns 134.
You&#8217;ll need to wrap parseFloat appropriately.
]]></description>
			<content:encoded><![CDATA[<p>Now I discover (well, the testers discover) JavaScript does not take locale into consideration when attempting to parse a float.</p>
<p>So if you&#8217;re localized to Belgium, then <code>parseFloat ('134,39')</code> returns <code>134</code>.</p>
<p>You&#8217;ll need to wrap <code>parseFloat</code> appropriately.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whump.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.whump.com%2FmoreLikeThis%2F2004%2F09%2F10%2F04064%2F&amp;seed_title=Parsing+Localized+Strings+in+JavaScript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Localized Date Parsing in JavaScript</title>
		<link>http://www.whump.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.whump.com%2FmoreLikeThis%2F2004%2F09%2F07%2F04062%2F&amp;seed_title=Localized+Date+Parsing+in+JavaScript</link>
		<comments>http://www.whump.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.whump.com%2FmoreLikeThis%2F2004%2F09%2F07%2F04062%2F&amp;seed_title=Localized+Date+Parsing+in+JavaScript#comments</comments>
		<pubDate>Tue, 07 Sep 2004 07:00:00 +0000</pubDate>
		<dc:creator>Bill Humphries</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[localization]]></category>

		<guid isPermaLink="false">http://www.whump.com/moreLikeThis/2004/09/07/04062/</guid>
		<description><![CDATA[Well heck. The JavaScript Date constructor&#8217;s not as smart as I thought (at least in Mozilla and Safari.)
I found this out while round-tripping a date.
I&#8217;m adding a row to a table.
var d = new Date ('m/y/d');

var ds = d.toLocaleDateString ();


The localized string became a text node in a table cell.
Later on, I want to use [...]]]></description>
			<content:encoded><![CDATA[<p>Well heck. The JavaScript <code>Date</code> constructor&#8217;s not as smart as I thought (at least in Mozilla and Safari.)</p>
<p>I found this out while round-tripping a date.</p>
<p>I&#8217;m adding a row to a table.</p>
<pre><code>var d = new Date ('m/y/d');

var ds = d.toLocaleDateString ();

</code></pre>
<p>The localized string became a text node in a table cell.</p>
<p>Later on, I want to use that date, so I get a copy from the table cell and parse it into another <code>Date</code> object.</p>
<pre><code>var nd = new Date (ds);

</code></pre>
<p>When you change from an English language locale, that last line fails because JavaScript does not appear to be able to parse a string such as &#8216;Dienstag, 7. September 2004&#8242; into a <code>Date</code> object.</p>
<p>So, if you want to have JavaScript do something inteligent with date strings embedded in a page, you&#8217;ll need to attach a parsable date string to the content. If dates are unique within the page, you could use the <code>id</code> attribute.</p>
<p><code>&lt;span class="date" id="date-9-7-2004"&gt;Dienstag, 7. September 2004&lt;/span&gt;</code></p>
<p>In practice, I do that programatically:</p>
<pre><code>var d = new Date ();

var x = document.createTextNode (d.toLocaleDateString());

var span = document.getElementsByTagName ('span')[0];

span.onclick = dateHandler;

span.id = 'date-' + (d.getMonth () + 1) + '-' +

    d.getDate () + '-' + d.getFullYear ();

span.appendChild (x);

</code></pre>
<p>Then attach a handler to all the <code>span</code>s with <code>class = 'date'</code>. Since <code>id</code>s start with alpha characters, you&#8217;ll need to store the date as something other than <code>9/7/2004</code>.</p>
<p>I&#8217;ve put this into <a href="http://www.whump.com/dropbox/javascript/date.html">a toy example</a>.</p>
<p><a href="http://whump.com/dropbox/javascript/date.html">Link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.whump.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.whump.com%2FmoreLikeThis%2F2004%2F09%2F07%2F04062%2F&amp;seed_title=Localized+Date+Parsing+in+JavaScript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
