summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-08-26 00:14:49 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-08-26 00:14:49 +0000
commite6d03d684ea66a6157c159cf1c233bef27e49407 (patch)
treed11c38fca7c1de77356454afde6fad0e0c6e3034
parent5b58c076243085bd8d6166e23a17f68518bf6dea (diff)
Cleaner gettext debug information reporting
-rw-r--r--lib/rbot/language.rb4
-rw-r--r--lib/rbot/load-gettext.rb12
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/rbot/language.rb b/lib/rbot/language.rb
index de446191..7c472303 100644
--- a/lib/rbot/language.rb
+++ b/lib/rbot/language.rb
@@ -6,7 +6,7 @@
# This module takes care of language handling for rbot:
# setting the core.language value, loading the appropriate
# .lang file etc.
-#
+
module Irc
module Language
@@ -68,8 +68,8 @@ module Language
l = language.to_s.gsub(/\s+/,'_').intern
if Lang2Locale.key?(l)
@locale = Lang2Locale[l]
- debug "locale set to #{@locale}"
setlocale(@locale)
+ debug "locale set to #{locale}"
else
warn "Unable to set locale, unknown language #{l}"
end
diff --git a/lib/rbot/load-gettext.rb b/lib/rbot/load-gettext.rb
index 1d7cb88b..9798fd60 100644
--- a/lib/rbot/load-gettext.rb
+++ b/lib/rbot/load-gettext.rb
@@ -1,4 +1,9 @@
-# load gettext module and provide fallback in case of failure
+#-- vim:sw=2:et
+#++
+#
+# :title: GetText interface for rbot
+#
+# Load gettext module and provide fallback in case of failure
class GetTextVersionError < Exception
end
@@ -34,11 +39,12 @@ begin
begin
require 'stringio'
gettext_info = StringIO.new
- current_textdomain_info(:out=>gettext_info) # fails sometimes
+ current_textdomain_info(:out => gettext_info) # fails sometimes
debug 'using ruby-gettext'
- gettext_info.string.each_line {|l| debug l}
rescue Exception
warn "ruby-gettext was loaded but appears to be non-functional. maybe an mo file doesn't exist for your locale."
+ ensure
+ gettext_info.string.each_line { |l| debug l}
end
rescue LoadError, GetTextVersionError