From e6d03d684ea66a6157c159cf1c233bef27e49407 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 26 Aug 2007 00:14:49 +0000 Subject: Cleaner gettext debug information reporting --- lib/rbot/language.rb | 4 ++-- lib/rbot/load-gettext.rb | 12 +++++++++--- 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 -- cgit v1.2.3