From 36ee7ca7c1e39bc0e0bc185ef2188795bbf0ac3f Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Tue, 25 May 2010 20:41:09 +0200 Subject: fallback to en if locale undefined --- date_locale.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/date_locale.rb b/date_locale.rb index 4ab9b4d..e40e6c7 100644 --- a/date_locale.rb +++ b/date_locale.rb @@ -217,7 +217,12 @@ module Date_locale monthnames = DATE_TEXTS[lang][:monthnames] abbr_monthnames = DATE_TEXTS[lang][:abbr_monthnames] else - raise "Missing Support for locale #{lang.inspect}" + #raise "Missing Support for locale #{lang.inspect}" + #fallback to english + daynames = DATE_TEXTS[:en][:daynames] + abbr_daynames = DATE_TEXTS[:en][:abbr_daynames] + monthnames = DATE_TEXTS[:en][:monthnames] + abbr_monthnames = DATE_TEXTS[:en][:abbr_monthnames] end #Make the original replacements, after.... -- cgit v1.2.3 From 8473add34098228f67ae33cd90e905fc83e2c5e6 Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Tue, 1 Jun 2010 09:13:06 +0200 Subject: bugfix: wrong locale caused exception --- timepollhead.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timepollhead.rb b/timepollhead.rb index 14f2339..56a85db 100644 --- a/timepollhead.rb +++ b/timepollhead.rb @@ -120,7 +120,7 @@ class TimePollHead ret = "" head_count("%Y-%m",false).each{|title,count| year, month = title.split("-").collect{|e| e.to_i} - ret += "#{Date::DATE_TEXTS[Date_locale.get_language_key(Locale.current)][:abbr_monthnames][month]} #{year}\n" + ret += "#{Date.parse("#{year}-#{month}-01").strftime("%b %Y")}\n" } ret += "" -- cgit v1.2.3 From 966ce4209f6a5ed13cf898a01998fbef8fdb5db4 Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Tue, 1 Jun 2010 09:59:10 +0200 Subject: additional bugfix for locale problem --- timepollhead.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/timepollhead.rb b/timepollhead.rb index 56a85db..dc4476c 100644 --- a/timepollhead.rb +++ b/timepollhead.rb @@ -253,7 +253,10 @@ END ret += "\n" - 7.times{|i| ret += "#{Date::DATE_TEXTS[Date_locale.get_language_key(Locale.current)][:abbr_daynames][(i+1)%7]}" } + 7.times{|i| + # 2010-03-01 was a Monday, so we can use this month for a dirty hack + ret += "#{Date.parse("2010-03-0#{i+1}").strftime("%a")}" + } ret += "\n" ((@startdate.wday+7-1)%7).times{ @@ -298,7 +301,7 @@ END ret += "" head_count("%Y-%m",true).each{|title,count| year,month = title.split("-").collect{|e| e.to_i} - ret += "#{Date::DATE_TEXTS[Date_locale.get_language_key(Locale.current)][:abbr_monthnames][month]} #{year}\n" + ret += "#{Date.parse("#{year}-#{month}-01").strftime("%b %Y")}\n" } ret += "" + _("Time") + "" -- cgit v1.2.3