]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
gettext: undefine GetText if we failed to load properly
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 11 Mar 2008 01:23:24 +0000 (02:23 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 11 Mar 2008 11:08:30 +0000 (12:08 +0100)
lib/rbot/load-gettext.rb

index 6d73929657b30ac62bdf0c5335210bd77f2a1cfd..5738f19726fd069293cb8a970d4477f4f1b0f607 100644 (file)
@@ -59,6 +59,12 @@ begin
 rescue LoadError, GetTextVersionError
   warn "failed to load ruby-gettext package: #{$!}; translations are disabled"
 
+  # undefine GetText, in case it got defined because the error was caused by a
+  # wrong version
+  if defined?(GetText)
+    Object.module_eval { remove_const("GetText") }
+  end
+
   # dummy functions that return msg_id without translation
   def _(s)
     s