Module GetText
In: lib/rbot/load-gettext.rb
GetText dot/m_28_0.png

Methods

External Aliases

bound_targets -> orig_bound_targets

Public Instance methods

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.

[Source]

    # File lib/rbot/load-gettext.rb, line 72
72:       def current_textdomain_info(options = {})
73:         opts = {:with_messages => false, :with_paths => false, :out => STDOUT}.merge(options)
74:         ret = nil
75:         # this is for 2.1.0
76:         TextDomainManager.each_textdomains(self) {|textdomain, lang|
77:           opts[:out].puts "TextDomain name: #{textdomain.name.inspect}"
78:           opts[:out].puts "TextDomain current locale: #{lang.to_s.inspect}"
79:           opts[:out].puts "TextDomain current mo path: #{textdomain.instance_variable_get(:@locale_path).current_path(lang).inspect}"
80:           if opts[:with_paths]
81:             opts[:out].puts "TextDomain locale file paths:"
82:             textdomain.locale_paths.each do |v|
83:               opts[:out].puts "  #{v}"
84:             end
85:           end
86:           if opts[:with_messages]
87:             opts[:out].puts "The messages in the mo file:"
88:             textdomain.current_mo.each{|k, v|
89:               opts[:out].puts "  \"#{k}\": \"#{v}\""
90:             }
91:           end
92:         }
93:       end

This method is used to output debug information on the GetText textdomain, and it‘s called by the language setting routines in rbot

[Source]

     # File lib/rbot/load-gettext.rb, line 99
 99:     def rbot_gettext_debug
100:       begin
101:         gettext_info = StringIO.new
102:         current_textdomain_info(:out => gettext_info) # fails sometimes
103:       rescue Exception
104:         warning "failed to retrieve textdomain info. maybe an mo file doesn't exist for your locale."
105:         debug $!
106:       ensure
107:         gettext_info.string.each_line { |l| debug l}
108:       end
109:     end

[Validate]