Documentation ¶
Overview ¶
Package po allows to read and write gettext po files.
Index ¶
Constants ¶
View Source
const ( HeaderProjectIDVersion = "Project-Id-Version" HeaderReportMsgIDBugsTo = "Report-Msgid-Bugs-To" HeaderPOTCreationDate = "POT-Creation-Date" HeaderPORevisionDate = "PO-Revision-Date" HeaderLastTranslator = "Last-Translator" HeaderLanguageTeam = "Language-Team" HeaderLanguage = "Language" HeaderMIMEVersion = "MIME-Version" HeaderContentType = "Content-Type" HeaderContentTransferEncoding = "Content-Transfer-Encoding" HeaderPluralForms = "Plural-Forms" HeaderXGenerator = "X-Generator" )
Variables ¶
This section is empty.
Functions ¶
func DecodePoString ¶
func EncodePoString ¶
Types ¶
type Comment ¶
type Comment struct { Translator string // # translator-comments Extracted string // #. extracted-comments References []*Reference // #: src/file.go:210 Flags []string // #, fuzzy,go-format,range:0..10 PrevMsgContext string // #| msgctxt previous-context PrevMsgID string // #| msgid previous-untranslated-string }
func NewComment ¶
func NewComment() *Comment
func (*Comment) AddReference ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
An Encoder writes a po file to an output stream.
func NewEncoder ¶
NewEncoder returns a new encoder that writes to w.
func (*Encoder) SetWrapWidth ¶
SetWrapWidth defines at which length the texts should be wrapped. To disable wrapping, the value can be set to -1. Default is -1.
func (*Encoder) SetWriteEmptyHeader ¶
SetWriteEmptyHeader sets whether a header without values should also be written or not. Default is true.
func (*Encoder) SetWriteHeader ¶
SetWriteHeader sets whether a header should be written or not. Default is true.
func (*Encoder) SetWriteReferences ¶
SetWriteReferences sets whether references to the origin of the text should be stored or not. Default is true.
type Header ¶
type Header struct { Comment *Comment // Header Comments ProjectIDVersion string // Project-Id-Version: PACKAGE VERSION ReportMsgidBugsTo string // Report-Msgid-Bugs-To: FIRST AUTHOR <EMAIL@ADDRESS> POTCreationDate string // POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE PORevisionDate string // PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE LastTranslator string // Last-Translator: FIRST AUTHOR <EMAIL@ADDRESS> LanguageTeam string // Language-Team: Language string // Language: de MimeVersion string // MIME-Version: 1.0 ContentType string // Content-Type: text/plain; charset=UTF-8 ContentTransferEncoding string // Content-Transfer-Encoding: 8bit PluralForms string // Plural-Forms: nplurals=2; plural=(n != 1); XGenerator string // X-Generator: Poedit 3.0.1 UnknownFields map[string]string }
type Message ¶
type Message struct { Comment *Comment Context string ID string IDPlural string Str map[int]string }
Message is a representation of a single message in a catalog.
func NewMessage ¶
func NewMessage() *Message
func (*Message) AddReference ¶
Click to show internal directories.
Click to hide internal directories.