Class: GetText::Tools::MsgInit
- Inherits:
-
Object
- Object
- GetText::Tools::MsgInit
- Includes:
- GetText
- Defined in:
- lib/gettext/tools/msginit.rb
Defined Under Namespace
Classes: ArgumentError, Error, ValidationError
Constant Summary
Constants included from GetText
BOM_UTF8, MOFile, MoFile, PoParser
Class Method Summary collapse
-
.run(*arguments) ⇒ void
Create a new .po file from initializing .pot file with user’s environment and input.
Instance Method Summary collapse
-
#initialize ⇒ MsgInit
constructor
:nodoc:.
-
#run(*arguments) ⇒ Object
Create .po file from .pot file, user’s inputs and metadata.
Methods included from GetText
#N_, #Nn_, #bindtextdomain, #bindtextdomain_to, #cgi, #cgi=, #create_mofiles, #create_mofiles_org, #gettext, included, #locale, #msgmerge, #ngettext, #npgettext, #nsgettext, #output_charset, #pgettext, #remove_bom, #set_cgi, #set_current_locale, #set_locale, #set_output_charset, #sgettext, #textdomain, #textdomain_to, #update_pofiles, #update_pofiles_org
Constructor Details
#initialize ⇒ MsgInit
:nodoc:
53 54 55 56 57 58 59 60 61 |
# File 'lib/gettext/tools/msginit.rb', line 53 def initialize #:nodoc: @input_file = nil @output_file = nil @locale = nil @language = nil @entry = nil @comment = nil @translator = nil end |
Class Method Details
.run(*arguments) ⇒ void
This method returns an undefined value.
Create a new .po file from initializing .pot file with user’s environment and input.
44 45 46 |
# File 'lib/gettext/tools/msginit.rb', line 44 def run(*arguments) new.run(*arguments) end |
Instance Method Details
#run(*arguments) ⇒ Object
Create .po file from .pot file, user’s inputs and metadata.
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/gettext/tools/msginit.rb', line 65 def run(*arguments) parse_arguments(*arguments) validate parser = POParser.new parser.ignore_fuzzy = false pot = parser.parse_file(@input_file, GetText::PO.new) po = replace_pot_header(pot) File.open(@output_file, "w") do |f| f.puts(po.to_s) end end |