]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Cleaner gettext debug information reporting
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 26 Aug 2007 00:14:49 +0000 (00:14 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 26 Aug 2007 00:14:49 +0000 (00:14 +0000)
lib/rbot/language.rb
lib/rbot/load-gettext.rb

index de446191d364d2e46d492906589ea0b7c0db5049..7c47230367aabe713197e746b870a01c03d5cb48 100644 (file)
@@ -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
index 1d7cb88b3b6f505175a8986dd7b4c34e75dc2ae1..9798fd60de5808cbd787c8ab8bad63ea9392cc1c 100644 (file)
@@ -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