Class: RDoc::Generator::POT::PO
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rdoc/generator/pot/po.rb |
Overview
Generates a PO
format text
Class Method Summary
-
.new ⇒ PO
constructor
Creates an object that represents
PO
format.
Instance Method Summary
-
#add(entry)
Adds a
PO
entry to thePO
. -
#to_s
Returns PO format text for the
PO
. - #add_header private
- #header_entry private
- #sort_entries private
Constructor Details
.new ⇒ PO
Creates an object that represents PO
format.
# File 'lib/rdoc/generator/pot/po.rb', line 10
def initialize @entries = {} add_header end
Instance Method Details
#add(entry)
Adds a PO
entry to the PO
.
# File 'lib/rdoc/generator/pot/po.rb', line 18
def add entry existing_entry = @entries[entry.msgid] if existing_entry entry = existing_entry.merge(entry) end @entries[entry.msgid] = entry end
#add_header (private)
[ GitHub ]# File 'lib/rdoc/generator/pot/po.rb', line 40
def add_header add(header_entry) end
#header_entry (private)
[ GitHub ]# File 'lib/rdoc/generator/pot/po.rb', line 44
def header_entry comment = <<-COMMENT SOME DESCRIPTIVE TITLE. Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER This file is distributed under the same license as the PACKAGE package. FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. COMMENT content = <<-CONTENT Project-Id-Version: PACKAGE VERSEION Report-Msgid-Bugs-To: PO-Revision-Date: YEAR-MO_DA HO:MI+ZONE Last-Translator: FULL NAME <EMAIL@ADDRESS> Language-Team: LANGUAGE <LL@li.org> Language: MIME-Version: 1.0 Content-Type: text/plain; charset=CHARSET Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=INTEGER; plural=EXPRESSION; CONTENT = { :msgstr => content, :translator_comment => comment, :flags => ['fuzzy'], } RDoc::Generator::POT::POEntry.new('', ) end
#sort_entries (private)
[ GitHub ]# File 'lib/rdoc/generator/pot/po.rb', line 73
def sort_entries headers, = @entries.values.partition do |entry| entry.msgid.empty? end # TODO: sort by location = .sort_by do |entry| entry.msgid end headers + end
#to_s
Returns PO format text for the PO
.
# File 'lib/rdoc/generator/pot/po.rb', line 29
def to_s po = '' sort_entries.each do |entry| po += "\n" unless po.empty? po += entry.to_s end po end