3 Sections
= %w(Headers Source Translated
)
4 attr_accessor
:status, :src, :dest, :type, :location
11 text
.split(/\n/).each
do |lin
|
14 if lin
=~
/^#(.) ([^:]*)(?::(.*))?/
19 @status = 'fuzzy' if type
== ',' and field
== 'fuzzy'
20 @type = value
if type
== '.' and field
== 'type'
21 @location = {:file => field
, :line => value
} if type
== ':'
22 elsif lin
=~
/^msgid (".*")/
26 boom(section
, lin
, text
)
33 elsif lin
=~
/^msgstr (".*")/
37 boom(section
, lin
, text
)
45 boom(section
, lin
, text
)
51 def boom(section
, line
, text
)
52 raise RuntimeError
, "Unexpected string in %s:\n %s\n\nFull text: %s" %
53 [Sections
[section
], line
, text
]
61 file
= 'po/es/mwcc.po'
62 strings
= File
.open(file
,'r').read
.split(/\n\n/)[1..-1].map
{|str
| PoStr
.new(str
)}