# This module takes care of language handling for rbot:
# setting the core.language value, loading the appropriate
# .lang file etc.
-#
+
module Irc
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
-# 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
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