Documentation ¶
Index ¶
Constants ¶
const ( ProjectIDVersion = "Project-Id-Version" ReportMsgidBugsTo = "Report-Msgid-Bugs-To" PotCreationDate = "POT-Creation-Date" PoRevisionDate = "PO-Revision-Date" LastTranslator = "Last-Translator" LanguageTeam = "Language-Team" Language = "Language" MimeVersion = "MIME-Version" ContentType = "Content-Type" ContentTransferEncoding = "Content-Transfer-Encoding" PluralForms = "Plural-Forms" XGenerator = "X-Generator" )
ProjectIDVersion is the key of a header rendered as => Project-Id-Version: PACKAGE VERSION ReportMsgidBugsTo is the key of a header rendered as => Report-Msgid-Bugs-To: FIRST AUTHOR <EMAIL@ADDRESS> PotCreationDate is the key of a header rendered as => POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE PoRevisionDate is the key of a header rendered as => PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE LastTranslator is the key of a header rendered as => Last-Translator: FIRST AUTHOR <EMAIL@ADDRESS> LanguageTeam is the key of a header rendered as => Language-Team: golang-china Language is the key of a header rendered as => Language: zh_CN MimeVersion is the key of a header rendered as => MIME-Version: 1.0 ContentType is the key of a header rendered as => Content-Type: text/plain; charset=UTF-8 ContentTransferEncoding is the key of a header rendered as => Content-Transfer-Encoding: 8bit PluralForms is the key of a header rendered as => Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1; XGenerator is the key of a header rendered as => X-Generator: Poedit 1.5.5
Variables ¶
This section is empty.
Functions ¶
func DecodePoString ¶
DecodePoString returns a plain text representation of a gettext encoded message
func EncodeCommentPoString ¶
EncodeCommentPoString returns a gettet encoded representation of a comment text
func EncodePoString ¶
EncodePoString returns a gettext encoded representation of a text message
Types ¶
type ByMessages ¶
type ByMessages []Message
ByMessages represents a list of messages
func (ByMessages) Len ¶
func (d ByMessages) Len() int
func (ByMessages) Less ¶
func (d ByMessages) Less(i, j int) bool
func (ByMessages) Swap ¶
func (d ByMessages) Swap(i, j int)
type Comment ¶
type Comment struct { StartLine int // comment start line TranslatorComment string // # translator-comments // TrimSpace ExtractedComment string // #. extracted-comments ReferenceFile []string // #: src/msgcmp.c:338 src/po-lex.c:699 ReferenceLine []int // #: src/msgcmp.c:338 src/po-lex.c:699 Flags []string // #, fuzzy,c-format,range:0..10 PrevMsgContext string // #| msgctxt previous-context PrevMsgID string // #| msgid previous-untranslated-string }
Comment represents every message's comments.
type Header ¶
type Header struct { Comment // Header Comments // ProjectIDVersion HeaderValue // Project-Id-Version: PACKAGE VERSION // ReportMsgidBugsTo HeaderValue // Report-Msgid-Bugs-To: FIRST AUTHOR <EMAIL@ADDRESS> // POTCreationDate HeaderValue // POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE // PORevisionDate HeaderValue // PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE // LastTranslator HeaderValue // Last-Translator: FIRST AUTHOR <EMAIL@ADDRESS> // LanguageTeam HeaderValue // Language-Team: golang-china // Language HeaderValue // Language: zh_CN // MimeVersion HeaderValue // MIME-Version: 1.0 // ContentType HeaderValue // Content-Type: text/plain; charset=UTF-8 // ContentTransferEncoding HeaderValue // Content-Transfer-Encoding: 8bit // PluralForms HeaderValue // Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1; // XGenerator HeaderValue // X-Generator: Poedit 1.5.5 Fields map[string]string UnknowFields map[string]string }
Header is the initial comments "SOME DESCRIPTIVE TITLE", "YEAR" and "FIRST AUTHOR <EMAIL@ADDRESS>, YEAR" ought to be replaced by sensible information.
See http://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html#Header-Entry
func (*Header) FromMessage ¶
FromMessage parses message headers
func (*Header) Get ¶
Get returns the value of a set standard or non-standard header, or an empty string if the header is not found
type LineReader ¶
type LineReader struct {
// contains filtered or unexported fields
}
LineReader Define line reader structure
func NewLineReader ¶
func NewLineReader(data string) *LineReader
NewLineReader Create a new line reader
type Message ¶
type Message struct { Comment // Coments MsgContext string // msgctxt context MsgID string // msgid untranslated-string MsgIDPlural string // msgid_plural untranslated-string-plural MsgStr string // msgstr translated-string MsgStrPlural []string // msgstr[0] translated-string-case-0 }
Message represents an original/translatable source message
func (*Message) ReadPoEntry ¶
func (p *Message) ReadPoEntry(r *LineReader) (err error)
ReadPoEntry Get entire entry from line reader