Translate months in GUI

From Kolmisoft Wiki

Revision as of 09:12, 11 February 2010 by Mindaugas (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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 very end 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)
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])

Restart Apache after that.

Personal tools


Try M2