Class: YARD::I18n::POParser
- Inherits:
-
Object
- Object
- YARD::I18n::POParser
- Defined in:
- lib/yard/i18n/po_parser.rb
Overview
Locale
is a wrapper for gettext’s PO parsing feature. It hides gettext API difference from YARD.
Class Method Summary collapse
-
.available? ⇒ Boolean
True if gettext is available, false otherwise.
Instance Method Summary collapse
-
#parse(file) ⇒ Hash<String, String>
Parses PO file.
Class Method Details
.available? ⇒ Boolean
Returns true if gettext is available, false otherwise.
37 38 39 |
# File 'lib/yard/i18n/po_parser.rb', line 37 def available? !@@gettext_version.nil? end |
Instance Method Details
#parse(file) ⇒ Hash<String, String>
Parses PO file.
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/yard/i18n/po_parser.rb', line 46 def parse(file) case @@gettext_version when 2 parser = GetText::PoParser.new data = GetText::MoFile.new when 3 parser = GetText::POParser.new data = GetText::MO.new end parser.report_warning = false parser.parse_file(file, data) data end |