Created
May 12, 2012 10:31
-
-
Save remi/2665712 to your computer and use it in GitHub Desktop.
I18n dates with Jekyll (dirty hack version)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# This file was generated by RubyGems. | |
# | |
# The application 'jekyll' is installed as part of a gem, and | |
# this file is here to facilitate running it. | |
# | |
require 'rubygems' | |
require 'pathname' # 1.8 | |
require File.join(File.dirname(__FILE__), "jekyll-remi.rb") # Added line | |
version = ">= 0" | |
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then | |
version = $1 | |
ARGV.shift | |
end | |
gem 'jekyll', version | |
load Gem.bin_path('jekyll', 'jekyll', version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require 'date' | |
require 'time' | |
Date::MONTHNAMES = [nil] + %w(janvier février mars avril mai juin juillet août septembre octobre novembre décembre) | |
Date::DAYNAMES = ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"] | |
class Time | |
alias :strftime_nolocale :strftime | |
def strftime(format) | |
format = format.dup | |
format.gsub!(/%a/, Date::ABBR_DAYNAMES[self.wday]) | |
format.gsub!(/%A/, Date::DAYNAMES[self.wday]) | |
format.gsub!(/%b/, Date::ABBR_MONTHNAMES[self.mon]) | |
format.gsub!(/%B/, Date::MONTHNAMES[self.mon]) | |
self.strftime_nolocale(format) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment