I just realized that the l (or localize) method in Rails (3.1.3 at the moment) appears to not manage the clock format base on the currently set locale. I have just assumed this was the case and not tested for this specifically... I have just verified that dates were re-formatted according to the locale.
I get a 24-hour clock for all of the following in my rails console. The only visible difference between the two locales is capitalization of the month name.
I18n.l Time.now, :format => :short, :locale => :"en"
I18n.l Time.now + 12.hours, :format => :short, :locale => :"en"
I18n.l Time.now, :format => :short, :locale => :"sv-SE"
I18n.l Time.now + 12.hours, :format => :short, :locale => :"sv-SE"
Now, why is that? Is this not part of localizing a time?
The only manual intervention of AM/PM I find is in generating the selects for forms where I can demand 12-hour clock "manually". An odd choice since it feels to me like just the kind of thing I want to rely on the locale for.
Looking at Mac OS, I do get to choose the language and the locale for format preferences separately, but that is why we have the en-US, en-GB, sv-SE naming, right? Signifying language-COUNTRY. It would be perfectly OK for me to add a en-SE file to my app containing English translations by formatting suitable in Sweden.
I assume not all US-developers go in and edit the defaults locale file for English (en-US looks the same as en btw) to get a 12-hour clock suitable for US users. So, feel free to show me how dumb I am. I fully expect this problem to be sure to something really really basic.
In short. What I am getting wrong? And how do I "fix" my timestamps? :)
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)