class FastGettext::PoFile

Responsibility:

- abstract po files for Po Repository

Public Class Methods

new(file, options={}) click to toggle source
Calls superclass method FastGettext::MoFile.new
# File lib/fast_gettext/po_file.rb, line 6
def initialize(file, options={})
  @options = options
  super
end
to_mo_file(file, options={}) click to toggle source
# File lib/fast_gettext/po_file.rb, line 11
def self.to_mo_file(file, options={})
  MoFile.new(parse_po_file(file, options))
end

Protected Class Methods

parse_po_file(file, options={}) click to toggle source
# File lib/fast_gettext/po_file.rb, line 26
def self.parse_po_file(file, options={})
  require 'fast_gettext/vendor/poparser'
  parser = FastGettext::GetText::PoParser.new

  warn ":ignore_obsolete is no longer supported, use :report_warning" if options.key? :ignore_obsolete
  parser.ignore_fuzzy = options[:ignore_fuzzy]
  parser.report_warning = options.fetch(:report_warning, true)

  mo_file = FastGettext::GetText::MOFile.new
  parser.parse_file(file, mo_file)
  mo_file
end

Protected Instance Methods

load_data() click to toggle source
# File lib/fast_gettext/po_file.rb, line 17
def load_data
  @data = if @filename.is_a? FastGettext::GetText::MOFile
    @filename
  else
    FastGettext::PoFile.parse_po_file(@filename, @options)
  end
  make_singular_and_plural_available
end