Class: FastGettext::PoFile

Inherits:
Object
  • Object
show all
Defined in:
lib/fast_gettext/po_file.rb

Overview

Responsibility:

- abstract po files for Po Repository

TODO refactor…

Class Method Summary collapse

Class Method Details

.to_mo_file(file, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fast_gettext/po_file.rb', line 7

def self.to_mo_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.read(file), mo_file)
  MoFile.new(mo_file)
end