Show the current textdomain information. This function is for debugging.
options: options as a Hash.
:with_messages - show informations with messages of the current mo file. Default is false.
:out - An output target. Default is STDOUT.
:with_paths - show the load paths for mo-files.
# File lib/rbot/load-gettext.rb, line 72 def current_textdomain_info(options = {}) opts = {:with_messages => false, :with_paths => false, :out => STDOUT}.merge(options) ret = nil # this is for 2.1.0 TextDomainManager.each_textdomains(self) {|textdomain, lang| opts[:out].puts "TextDomain name: #{textdomain.name.inspect}" opts[:out].puts "TextDomain current locale: #{lang.to_s.inspect}" opts[:out].puts "TextDomain current mo path: #{textdomain.instance_variable_get(:@locale_path).current_path(lang).inspect}" if opts[:with_paths] opts[:out].puts "TextDomain locale file paths:" textdomain.locale_paths.each do |v| opts[:out].puts " #{v}" end end if opts[:with_messages] opts[:out].puts "The messages in the mo file:" textdomain.current_mo.each{|k, v| opts[:out].puts " \"#{k}\": \"#{v}\"" } end } end
This method is used to output debug information on the GetText textdomain, and it's called by the language setting routines in rbot
# File lib/rbot/load-gettext.rb, line 99 def rbot_gettext_debug begin gettext_info = StringIO.new current_textdomain_info(:out => gettext_info) # fails sometimes rescue Exception warning "failed to retrieve textdomain info. maybe an mo file doesn't exist for your locale." debug $! ensure gettext_info.string.each_line { |l| debug l} end end
Generated with the Darkfish Rdoc Generator 2.