Translate months in GUI
From Kolmisoft Wiki
Jump to navigationJump to search
Lets say we want to have all months in GUI in Polish.
Then in /home/mor/config/environment.rb (make backup of this file before editing it!) at the add:
class Date Date::MONTHNAMES = [nil] + %w(Styczeń Luty Marzec Kwiecień Maj Czerwiec Lipiec Sierpień Wrzesień Październik Listopad Grudzień) Date::DAYNAMES = %w(Domingo Lunes Martes Miércoles Jueves Viernes Sábado) Date::ABBR_MONTHNAMES = [nil] + %w(Ene Feb Mar Abr May Jun Jul Ago Sep Oct Nov Dic) Date::ABBR_DAYNAMES = %w(Dom Lun Mar Mié Jue Vie Sab) end
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
Restart Apache after that.