<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer" nil="true"></assigned-user-id>
  <attachments-count type="integer">0</attachments-count>
  <closed type="boolean">true</closed>
  <created-at type="datetime">2008-12-18T16:44:27+00:00</created-at>
  <creator-id type="integer">18793</creator-id>
  <milestone-due-on type="datetime" nil="true"></milestone-due-on>
  <milestone-id type="integer">9903</milestone-id>
  <number type="integer">1596</number>
  <permalink>rfc822-shouldnt-be-localized</permalink>
  <priority type="integer">942</priority>
  <project-id type="integer">8994</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>invalid</state>
  <tag>i18n</tag>
  <title>RFC822 shouldn't be localized</title>
  <updated-at type="datetime">2009-06-03T09:38:13+01:00</updated-at>
  <user-id type="integer">3117</user-id>
  <user-name>Bart Zonneveld</user-name>
  <creator-name>J&#233;r&#233;my</creator-name>
  <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
  <milestone-title>2.x</milestone-title>
  <original-body>Hi,

I've found that a date formatted as RFC822 is localized like any other format, and as far as I can tell this format should not be localized.

I've found the problem when I tried to have my RSS feeds localized in my freshly internationalized app.
In english, the &quot;pubDate&quot; is well formed (Wed, 17 Dec 2008 11:07:01 +0100), but in other languages (french by exemple), the date looks like this : &quot;jeu, 18 d&#233;c 2008 09:48:34 +0100&quot;

The Feed validator (http://feedvalidator.org/) tells me that the feed is invalid and my RSS agregator (NetNewsWire) is not showing the correct date (the last synced date)

Strangely, this behavour is permanent on a Debian server with Nginx/Mongrel/Rails2.2.2/... but it's not permanent on my local MacBookPro using Passenger. I've struggled quitea long time to stop the localization before I've started to write this ticket, and now it's working with not code change at all.

Maybe there is something wrong on my side. I'm confused.</original-body>
  <latest-body>Hi,

I've found that a date formatted as RFC822 is localized like any other format, and as far as I can tell this format should not be localized.

I've found the problem when I tried to have my RSS feeds localized in my freshly internationalized app.
In english, the &quot;pubDate&quot; is well formed (Wed, 17 Dec 2008 11:07:01 +0100), but in other languages (french by exemple), the date looks like this : &quot;jeu, 18 d&#233;c 2008 09:48:34 +0100&quot;

The Feed validator (http://feedvalidator.org/) tells me that the feed is invalid and my RSS agregator (NetNewsWire) is not showing the correct date (the last synced date)

Strangely, this behavour is permanent on a Debian server with Nginx/Mongrel/Rails2.2.2/... but it's not permanent on my local MacBookPro using Passenger. I've struggled quitea long time to stop the localization before I've started to write this ticket, and now it's working with not code change at all.

Maybe there is something wrong on my side. I'm confused.</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I've found that a date formatted as RFC822 is localized like any
other format, and as far as I can tell this format should not be
localized.&lt;/p&gt;
&lt;p&gt;I've found the problem when I tried to have my RSS feeds
localized in my freshly internationalized app. In english, the
&quot;pubDate&quot; is well formed (Wed, 17 Dec 2008 11:07:01 +0100), but in
other languages (french by exemple), the date looks like this :
&quot;jeu, 18 d&amp;eacute;c 2008 09:48:34 +0100&quot;&lt;/p&gt;
&lt;p&gt;The Feed validator (&lt;a href=&quot;http://feedvalidator.org/)&quot;&gt;http://feedvalidator.org/)&lt;/a&gt; tells
me that the feed is invalid and my RSS agregator (NetNewsWire) is
not showing the correct date (the last synced date)&lt;/p&gt;
&lt;p&gt;Strangely, this behavour is permanent on a Debian server with
Nginx/Mongrel/Rails2.2.2/... but it's not permanent on my local
MacBookPro using Passenger. I've struggled quitea long time to stop
the localization before I've started to write this ticket, and now
it's working with not code change at all.&lt;/p&gt;
&lt;p&gt;Maybe there is something wrong on my side. I'm confused.&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Hi,

I've found that a date formatted as RFC822 is localized like any other format, and as far as I can tell this format should not be localized.

I've found the problem when I tried to have my RSS feeds localized in my freshly internationalized app.
In english, the &quot;pubDate&quot; is well formed (Wed, 17 Dec 2008 11:07:01 +0100), but in other languages (french by exemple), the date looks like this : &quot;jeu, 18 d&#233;c 2008 09:48:34 +0100&quot;

The Feed validator (http://feedvalidator.org/) tells me that the feed is invalid and my RSS agregator (NetNewsWire) is not showing the correct date (the last synced date)

Strangely, this behavour is permanent on a Debian server with Nginx/Mongrel/Rails2.2.2/... but it's not permanent on my local MacBookPro using Passenger. I've struggled quitea long time to stop the localization before I've started to write this ticket, and now it's working with not code change at all.

Maybe there is something wrong on my side. I'm confused.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I've found that a date formatted as RFC822 is localized like any
other format, and as far as I can tell this format should not be
localized.&lt;/p&gt;
&lt;p&gt;I've found the problem when I tried to have my RSS feeds
localized in my freshly internationalized app. In english, the
&quot;pubDate&quot; is well formed (Wed, 17 Dec 2008 11:07:01 +0100), but in
other languages (french by exemple), the date looks like this :
&quot;jeu, 18 d&amp;eacute;c 2008 09:48:34 +0100&quot;&lt;/p&gt;
&lt;p&gt;The Feed validator (&lt;a href=&quot;http://feedvalidator.org/)&quot;&gt;http://feedvalidator.org/)&lt;/a&gt; tells
me that the feed is invalid and my RSS agregator (NetNewsWire) is
not showing the correct date (the last synced date)&lt;/p&gt;
&lt;p&gt;Strangely, this behavour is permanent on a Debian server with
Nginx/Mongrel/Rails2.2.2/... but it's not permanent on my local
MacBookPro using Passenger. I've struggled quitea long time to stop
the localization before I've started to write this ticket, and now
it's working with not code change at all.&lt;/p&gt;
&lt;p&gt;Maybe there is something wrong on my side. I'm confused.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-18T16:44:27+00:00</created-at>
      <creator-id type="integer">18793</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1596</number>
      <permalink>rfc822-shouldnt-be-localized</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>RFC822 shouldn't be localized</title>
      <updated-at type="datetime">2008-12-18T16:44:31+00:00</updated-at>
      <user-id type="integer">18793</user-id>
      <user-name>J&#233;r&#233;my</user-name>
      <creator-name>J&#233;r&#233;my</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Could you please pastie the code that leads to this?</body>
      <body-html>&lt;div&gt;&lt;p&gt;Could you please pastie the code that leads to this?&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-18T18:18:23+00:00</created-at>
      <creator-id type="integer">18793</creator-id>
      <diffable-attributes type="yaml">--- 
:tag: 
</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1596</number>
      <permalink>rfc822-shouldnt-be-localized</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>i18n</tag>
      <title>RFC822 shouldn't be localized</title>
      <updated-at type="datetime">2008-12-18T18:18:28+00:00</updated-at>
      <user-id type="integer">11102</user-id>
      <user-name>Yaroslav Markin</user-name>
      <creator-name>J&#233;r&#233;my</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Freaking strange ! I can't reproce my own bug today, sorry.

If I see it again and can nail it precisely, I'll warn you. Thanks anyway.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Freaking strange ! I can't reproce my own bug today, sorry.&lt;/p&gt;
&lt;p&gt;If I see it again and can nail it precisely, I'll warn you.
Thanks anyway.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-19T11:49:47+00:00</created-at>
      <creator-id type="integer">18793</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1596</number>
      <permalink>rfc822-shouldnt-be-localized</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>i18n</tag>
      <title>RFC822 shouldn't be localized</title>
      <updated-at type="datetime">2008-12-19T11:49:50+00:00</updated-at>
      <user-id type="integer">18793</user-id>
      <user-name>J&#233;r&#233;my</user-name>
      <creator-name>J&#233;r&#233;my</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Will reopen once we have a test case.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Will reopen once we have a test case.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2008-12-19T13:50:26+00:00</created-at>
      <creator-id type="integer">18793</creator-id>
      <diffable-attributes type="yaml">--- 
:state: new
</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1596</number>
      <permalink>rfc822-shouldnt-be-localized</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>invalid</state>
      <tag>i18n</tag>
      <title>RFC822 shouldn't be localized</title>
      <updated-at type="datetime">2008-12-19T13:50:27+00:00</updated-at>
      <user-id type="integer">1366</user-id>
      <user-name>Pratik</user-name>
      <creator-name>J&#233;r&#233;my</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Hey,

I can see it again ! Like I said, on my local (OS X 10.5.6) it's always localized in english, but on my production/staging server (Debian stable up-to-date), it's always in french.

Here is the code involved : http://gist.github.com/41793

I've check for differences in the &quot;locale&quot; command in the shell, 

Mac OS X: $ locale
LANG=&quot;fr_FR.UTF-8&quot;
LC_COLLATE=&quot;fr_FR.UTF-8&quot;
LC_CTYPE=&quot;fr_FR.UTF-8&quot;
LC_MESSAGES=&quot;fr_FR.UTF-8&quot;
LC_MONETARY=&quot;fr_FR.UTF-8&quot;
LC_NUMERIC=&quot;fr_FR.UTF-8&quot;
LC_TIME=&quot;fr_FR.UTF-8&quot;
LC_ALL=

Debian: $ locale
LANG=fr_FR.UTF-8@euro
LC_CTYPE=&quot;fr_FR.UTF-8@euro&quot;
LC_NUMERIC=&quot;fr_FR.UTF-8@euro&quot;
LC_TIME=&quot;fr_FR.UTF-8@euro&quot;
LC_COLLATE=&quot;fr_FR.UTF-8@euro&quot;
LC_MONETARY=&quot;fr_FR.UTF-8@euro&quot;
LC_MESSAGES=&quot;fr_FR.UTF-8@euro&quot;
LC_PAPER=&quot;fr_FR.UTF-8@euro&quot;
LC_NAME=&quot;fr_FR.UTF-8@euro&quot;
LC_ADDRESS=&quot;fr_FR.UTF-8@euro&quot;
LC_TELEPHONE=&quot;fr_FR.UTF-8@euro&quot;
LC_MEASUREMENT=&quot;fr_FR.UTF-8@euro&quot;
LC_IDENTIFICATION=&quot;fr_FR.UTF-8@euro&quot;
LC_ALL=




I suspect this not to be related to rails, but to my environment, although I don't where to look at !

Thanks for any clue.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Hey,&lt;/p&gt;
&lt;p&gt;I can see it again ! Like I said, on my local (OS X 10.5.6) it's
always localized in english, but on my production/staging server
(Debian stable up-to-date), it's always in french.&lt;/p&gt;
&lt;p&gt;Here is the code involved : &lt;a href=&quot;http://gist.github.com/41793&quot;&gt;http://gist.github.com/41793&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I've check for differences in the &quot;locale&quot; command in the
shell,&lt;/p&gt;
&lt;p&gt;Mac OS X: $ locale LANG=&quot;fr_FR.UTF-8&quot; LC_COLLATE=&quot;fr_FR.UTF-8&quot;
LC_CTYPE=&quot;fr_FR.UTF-8&quot; LC_MESSAGES=&quot;fr_FR.UTF-8&quot;
LC_MONETARY=&quot;fr_FR.UTF-8&quot; LC_NUMERIC=&quot;fr_FR.UTF-8&quot;
LC_TIME=&quot;fr_FR.UTF-8&quot; LC_ALL=&lt;/p&gt;
&lt;p&gt;Debian: $ locale LANG=fr_FR.UTF-8@euro
LC_CTYPE=&quot;fr_FR.UTF-8@euro&quot; LC_NUMERIC=&quot;fr_FR.UTF-8@euro&quot;
LC_TIME=&quot;fr_FR.UTF-8@euro&quot; LC_COLLATE=&quot;fr_FR.UTF-8@euro&quot;
LC_MONETARY=&quot;fr_FR.UTF-8@euro&quot; LC_MESSAGES=&quot;fr_FR.UTF-8@euro&quot;
LC_PAPER=&quot;fr_FR.UTF-8@euro&quot; LC_NAME=&quot;fr_FR.UTF-8@euro&quot;
LC_ADDRESS=&quot;fr_FR.UTF-8@euro&quot; LC_TELEPHONE=&quot;fr_FR.UTF-8@euro&quot;
LC_MEASUREMENT=&quot;fr_FR.UTF-8@euro&quot;
LC_IDENTIFICATION=&quot;fr_FR.UTF-8@euro&quot; LC_ALL=&lt;/p&gt;
&lt;p&gt;I suspect this not to be related to rails, but to my
environment, although I don't where to look at !&lt;/p&gt;
&lt;p&gt;Thanks for any clue.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2008-12-30T23:01:19+00:00</created-at>
      <creator-id type="integer">18793</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1596</number>
      <permalink>rfc822-shouldnt-be-localized</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>invalid</state>
      <tag>i18n</tag>
      <title>RFC822 shouldn't be localized</title>
      <updated-at type="datetime">2008-12-30T23:01:20+00:00</updated-at>
      <user-id type="integer">18793</user-id>
      <user-name>J&#233;r&#233;my</user-name>
      <creator-name>J&#233;r&#233;my</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>On the production server, inside the console, it's in english (as it should, and not in french as it is in the real app)

@@@
$ script/console staging
Loading staging environment (Rails 2.2.2)
&gt;&gt; I18n.locale
=&gt; :fr
&gt;&gt; Time.now
=&gt; Wed Dec 31 00:10:17 +0100 2008
&gt;&gt; Time.now.to_s(:rfc822)
=&gt; &quot;Wed, 31 Dec 2008 00:10:28 +0100&quot;
&gt;&gt; 
@@@</body>
      <body-html>&lt;div&gt;&lt;p&gt;On the production server, inside the console, it's in english
(as it should, and not in french as it is in the real app)&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
$ script/console staging
Loading staging environment (Rails 2.2.2)
&amp;gt;&amp;gt; I18n.locale
=&amp;gt; :fr
&amp;gt;&amp;gt; Time.now
=&amp;gt; Wed Dec 31 00:10:17 +0100 2008
&amp;gt;&amp;gt; Time.now.to_s(:rfc822)
=&amp;gt; &amp;quot;Wed, 31 Dec 2008 00:10:28 +0100&amp;quot;
&amp;gt;&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2008-12-30T23:12:18+00:00</created-at>
      <creator-id type="integer">18793</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1596</number>
      <permalink>rfc822-shouldnt-be-localized</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>invalid</state>
      <tag>i18n</tag>
      <title>RFC822 shouldn't be localized</title>
      <updated-at type="datetime">2008-12-30T23:12:23+00:00</updated-at>
      <user-id type="integer">18793</user-id>
      <user-name>J&#233;r&#233;my</user-name>
      <creator-name>J&#233;r&#233;my</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Can't reproduce:

@@@
Loading development environment (Rails 2.3.0)
&gt;&gt; I18n.locale
=&gt; :ru
&gt;&gt; Time.now
=&gt; Thu Jan 01 22:14:11 +0300 2009
&gt;&gt; Time.now.to_s(:rfc822)
=&gt; &quot;Thu, 01 Jan 2009 22:14:21 +0200&quot;
&gt;&gt; I18n.l Time.now
=&gt; &quot;&#1063;&#1090;, 01 &#1103;&#1085;&#1074;. 2009, 22:15:17 +0200&quot;
@@@

AFAIK Time#to_s should not take I18n into account at all -- you can localize time using I18n.l, but to_s is not overloaded.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Can't reproduce:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
Loading development environment (Rails 2.3.0)
&amp;gt;&amp;gt; I18n.locale
=&amp;gt; :ru
&amp;gt;&amp;gt; Time.now
=&amp;gt; Thu Jan 01 22:14:11 +0300 2009
&amp;gt;&amp;gt; Time.now.to_s(:rfc822)
=&amp;gt; &amp;quot;Thu, 01 Jan 2009 22:14:21 +0200&amp;quot;
&amp;gt;&amp;gt; I18n.l Time.now
=&amp;gt; &amp;quot;&#1063;&#1090;, 01 &#1103;&#1085;&#1074;. 2009, 22:15:17 +0200&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;AFAIK Time#to_s should not take I18n into account at all -- you
can localize time using I18n.l, but to_s is not overloaded.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-01-01T19:15:35+00:00</created-at>
      <creator-id type="integer">18793</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1596</number>
      <permalink>rfc822-shouldnt-be-localized</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>invalid</state>
      <tag>i18n</tag>
      <title>RFC822 shouldn't be localized</title>
      <updated-at type="datetime">2009-01-01T19:15:39+00:00</updated-at>
      <user-id type="integer">11102</user-id>
      <user-name>Yaroslav Markin</user-name>
      <creator-name>J&#233;r&#233;my</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>You may have some kind of pre-I18n localization plugin/gem installed that overrides Time#to_s</body>
      <body-html>&lt;div&gt;&lt;p&gt;You may have some kind of pre-I18n localization plugin/gem
installed that overrides Time#to_s&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-01-01T19:16:25+00:00</created-at>
      <creator-id type="integer">18793</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1596</number>
      <permalink>rfc822-shouldnt-be-localized</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>invalid</state>
      <tag>i18n</tag>
      <title>RFC822 shouldn't be localized</title>
      <updated-at type="datetime">2009-01-01T19:16:27+00:00</updated-at>
      <user-id type="integer">11102</user-id>
      <user-name>Yaroslav Markin</user-name>
      <creator-name>J&#233;r&#233;my</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Hello Yaroslav

Thanks for your help

I'm digging and have not found anything in installed plugins or gem.

I've noticed that in my views :

@@@
&lt;% Date.today.strftime(&quot;%A&quot;) + &quot; - &quot; + Time.now.strftime(&quot;%A&quot;) %&gt;
@@@

turns into

@@@
Saturday - samedi
@@@

I guess that the Date object is correctly handled (not localized) but the Time is not.

In irb, script/console, or straight ruby in the command line, the Time object is not localized.

I also tested this in another Rails app, running 2.1.1 (same server) and both Date and Time a strftime-ed correctly (ie not localized)

I continue to dig and try to look for the culprit, but if you have any idea with the details I gave you, you're welcome.

Thanks again for what you do</body>
      <body-html>&lt;div&gt;&lt;p&gt;Hello Yaroslav&lt;/p&gt;
&lt;p&gt;Thanks for your help&lt;/p&gt;
&lt;p&gt;I'm digging and have not found anything in installed plugins or
gem.&lt;/p&gt;
&lt;p&gt;I've noticed that in my views :&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&amp;lt;% Date.today.strftime(&amp;quot;%A&amp;quot;) + &amp;quot; - &amp;quot; + Time.now.strftime(&amp;quot;%A&amp;quot;) %&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;turns into&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
Saturday - samedi
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I guess that the Date object is correctly handled (not
localized) but the Time is not.&lt;/p&gt;
&lt;p&gt;In irb, script/console, or straight ruby in the command line,
the Time object is not localized.&lt;/p&gt;
&lt;p&gt;I also tested this in another Rails app, running 2.1.1 (same
server) and both Date and Time a strftime-ed correctly (ie not
localized)&lt;/p&gt;
&lt;p&gt;I continue to dig and try to look for the culprit, but if you
have any idea with the details I gave you, you're welcome.&lt;/p&gt;
&lt;p&gt;Thanks again for what you do&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-01-02T23:40:09+00:00</created-at>
      <creator-id type="integer">18793</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1596</number>
      <permalink>rfc822-shouldnt-be-localized</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>invalid</state>
      <tag>i18n</tag>
      <title>RFC822 shouldn't be localized</title>
      <updated-at type="datetime">2009-01-02T23:40:10+00:00</updated-at>
      <user-id type="integer">18793</user-id>
      <user-name>J&#233;r&#233;my</user-name>
      <creator-name>J&#233;r&#233;my</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I've created a brand new app, with Rails 2.2.2 and a basic scaffold just to be able to call a view with some debug code in it.

Everything worked as expected. So I'vetried to move in piece by piece some stuff from my weird app : plugins (1 by 1), initializers, locales, libs, &#8230;

Then I remembered that I've seen something strange in Rails about the rfc822 method :

http://github.com/rails/rails/tree/2-2-stable/activesupport/lib/active_support/time_with_zone.rb (lines 145 -&gt; 152
@@@
    def to_s(format = :default)
      return utc.to_s(format) if format == :db
      if formatter = ::Time::DATE_FORMATS[format]
        formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
      else
        &quot;#{time.strftime(&quot;%Y-%m-%d %H:%M:%S&quot;)} #{formatted_offset(false, 'UTC')}&quot; # mimicking Ruby 1.9 Time#to_s format
      end
    end
@@@

I can see that it checks if the formatter respond_to? :call and if not it uses a basic strftime.

In my new app whre it's working great, I've got this :

@@@
I18n.locale : fr
I18n.default_locale : fr
Date.today.strftime(&quot;%A&quot;) : Saturday
Time.now.strftime(&quot;%A&quot;) : Saturday
Time.now.rfc822 : Sat, 03 Jan 2009 02:13:06 +0100
Time.now.strftime(&quot;%a, %d %b %Y %T %z&quot;) : Sat, 03 Jan 2009 02:13:06 +0100
I18n.l(Time.now, :format =&gt; &quot;%a, %d %b %Y %T %z&quot;) : Sam, 03 Jan 2009 02:13:06 +0100
@@@

It shows that if I try to localize a Time with a strftime format it's indeed localized.

So I think that maybe it's going through a localized strftime instead of the normal call.

By the way I dont really understand what &quot;formatter.call(self).to_s&quot; does.
If it's calling a method named after the formatter if it exists, with self as paramater, it means that it tries to call a rfc822() method. Anyway, I don't get it !</body>
      <body-html>&lt;div&gt;&lt;p&gt;I've created a brand new app, with Rails 2.2.2 and a basic
scaffold just to be able to call a view with some debug code in
it.&lt;/p&gt;
&lt;p&gt;Everything worked as expected. So I'vetried to move in piece by
piece some stuff from my weird app : plugins (1 by 1),
initializers, locales, libs, &amp;#8230;&lt;/p&gt;
&lt;p&gt;Then I remembered that I've seen something strange in Rails
about the rfc822 method :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://github.com/rails/rails/tree/2-2-stable/activesupport/lib/active_support/time_with_zone.rb&quot;&gt;
http://github.com/rails/rails/tr...&lt;/a&gt; (lines 145 -&amp;gt; 152&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
    def to_s(format = :default)
      return utc.to_s(format) if format == :db
      if formatter = ::Time::DATE_FORMATS[format]
        formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
      else
        &amp;quot;#{time.strftime(&amp;quot;%Y-%m-%d %H:%M:%S&amp;quot;)} #{formatted_offset(false, 'UTC')}&amp;quot; # mimicking Ruby 1.9 Time#to_s format
      end
    end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I can see that it checks if the formatter respond_to? :call and
if not it uses a basic strftime.&lt;/p&gt;
&lt;p&gt;In my new app whre it's working great, I've got this :&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
I18n.locale : fr
I18n.default_locale : fr
Date.today.strftime(&amp;quot;%A&amp;quot;) : Saturday
Time.now.strftime(&amp;quot;%A&amp;quot;) : Saturday
Time.now.rfc822 : Sat, 03 Jan 2009 02:13:06 +0100
Time.now.strftime(&amp;quot;%a, %d %b %Y %T %z&amp;quot;) : Sat, 03 Jan 2009 02:13:06 +0100
I18n.l(Time.now, :format =&amp;gt; &amp;quot;%a, %d %b %Y %T %z&amp;quot;) : Sam, 03 Jan 2009 02:13:06 +0100
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It shows that if I try to localize a Time with a strftime format
it's indeed localized.&lt;/p&gt;
&lt;p&gt;So I think that maybe it's going through a localized strftime
instead of the normal call.&lt;/p&gt;
&lt;p&gt;By the way I dont really understand what
&quot;formatter.call(self).to_s&quot; does. If it's calling a method named
after the formatter if it exists, with self as paramater, it means
that it tries to call a rfc822() method. Anyway, I don't get it
!&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-01-03T01:27:41+00:00</created-at>
      <creator-id type="integer">18793</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1596</number>
      <permalink>rfc822-shouldnt-be-localized</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>invalid</state>
      <tag>i18n</tag>
      <title>RFC822 shouldn't be localized</title>
      <updated-at type="datetime">2009-01-03T01:27:43+00:00</updated-at>
      <user-id type="integer">18793</user-id>
      <user-name>J&#233;r&#233;my</user-name>
      <creator-name>J&#233;r&#233;my</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>According to my findings, the localized_dates plugin causes Time.to_s(:rfc822) to be formatted. I'll file a bug report to the maintainers.</body>
      <body-html>&lt;div&gt;&lt;p&gt;According to my findings, the localized_dates plugin causes
Time.to_s(:rfc822) to be formatted. I'll file a bug report to the
maintainers.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-06-03T09:38:08+01:00</created-at>
      <creator-id type="integer">18793</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1596</number>
      <permalink>rfc822-shouldnt-be-localized</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>invalid</state>
      <tag>i18n</tag>
      <title>RFC822 shouldn't be localized</title>
      <updated-at type="datetime">2009-06-03T09:38:13+01:00</updated-at>
      <user-id type="integer">3117</user-id>
      <user-name>Bart Zonneveld</user-name>
      <creator-name>J&#233;r&#233;my</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1596</url>
      <milestone-title>2.x</milestone-title>
    </version>
  </versions>
</ticket>
