Class: GetText::Tools::MsgFmt
- Inherits:
-
Object
- Object
- GetText::Tools::MsgFmt
- Includes:
- GetText
- Defined in:
- lib/gettext/tools/msgfmt.rb
Overview
:nodoc:
Constant Summary
Constants included from GetText
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ MsgFmt
constructor
A new instance of MsgFmt.
-
#initialize_arguments(*options) ⇒ Object
:nodoc:.
- #parse_commandline_options(*options) ⇒ Object
-
#run(*options) ⇒ Object
:nodoc:.
Methods included from GetText
#N_, #Nn_, #bindtextdomain, #bindtextdomain_to, #cgi, #cgi=, #gettext, included, #locale, #ngettext, #npgettext, #nsgettext, #output_charset, #pgettext, #set_cgi, #set_current_locale, #set_locale, #set_output_charset, #sgettext, #textdomain, #textdomain_to
Constructor Details
#initialize ⇒ MsgFmt
Returns a new instance of MsgFmt.
46 47 48 49 |
# File 'lib/gettext/tools/msgfmt.rb', line 46 def initialize @input_file = nil @output_file = nil end |
Class Method Details
.run(*arguments) ⇒ Object
37 38 39 |
# File 'lib/gettext/tools/msgfmt.rb', line 37 def run(*arguments) new.run(*arguments) end |
Instance Method Details
#initialize_arguments(*options) ⇒ Object
:nodoc:
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/gettext/tools/msgfmt.rb', line 61 def initialize_arguments(*) # :nodoc: input_file, output_file = (*) if input_file.nil? raise(ArgumentError, _("no input files specified.")) end if output_file.nil? output_file = "messages.mo" end @input_file = input_file @output_file = output_file end |
#parse_commandline_options(*options) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/gettext/tools/msgfmt.rb', line 76 def (*) output_file = nil parser = OptionParser.new parser. = _("Usage: %s input.po [-o output.mo]" % $0) parser.separator("") description = _("Generate binary message catalog from textual " + "translation description.") parser.separator(description) parser.separator("") parser.separator(_("Specific options:")) parser.on("-o", "--output=FILE", _("write output to specified file")) do |out| output_file = out end parser.on_tail("--version", _("display version information and exit")) do puts(VERSION) exit(true) end parser.parse!() input_file = [0] [input_file, output_file] end |