Class: I18nPoTools::Formats::PropertiesFormat

Inherits:
BaseFormat
  • Object
show all
Defined in:
lib/i18n_po_tools/formats/properties_format.rb

Instance Attribute Summary

Attributes inherited from BaseFormat

#options

Instance Method Summary collapse

Methods inherited from BaseFormat

#banner_msg, #file_encoding, #read_file, #read_with_options, #write_file, #write_with_options

Instance Method Details

#read(input_filename) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/i18n_po_tools/formats/properties_format.rb', line 7

def read(input_filename)
  content = read_file(input_filename)
  props = JavaProperties.parse(content)
  h = {}
  props.each{|key,value| h[key.to_s]=value }
  h
end

#write(output_filename, data) ⇒ Object



15
16
17
18
# File 'lib/i18n_po_tools/formats/properties_format.rb', line 15

def write(output_filename, data)
  content = JavaProperties.generate(hash)
  write_file(output_filename, content)
end