xliff

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version                  = "1.2"
	FileExtension            = "xlf"
	MIMEType                 = "application/x-xliff+xml"
	XMLNS                    = "urn:oasis:names:tc:xliff:document:1.2"
	DefaultFileOriginal      = "original.xlf"
	FileDataTypePlainText    = "plaintext"
	DefaultHeaderToolID      = version.PackageName
	DefaultHeaderToolName    = version.DisplayName + " XLIFF"
	DefaultHeaderToolVersion = version.Version
)

const ...

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	XMLName       xml.Name     `xml:"body"`
	TransUnitList []*TransUnit `xml:"trans-unit"`
}

Body : http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#body

type File

type File struct {
	XMLName        xml.Name `xml:"file"`
	Date           string   `xml:"date,attr"`
	Original       string   `xml:"original,attr"`
	DataType       string   `xml:"datatype,attr"`
	SourceLanguage string   `xml:"source-language,attr"`
	TargetLanguage string   `xml:"target-language,attr"`
	Header         Header   `xml:"header"`
	Body           Body     `xml:"body"`
}

File : http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#file

type Header struct {
	XMLName xml.Name `xml:"header"`
	Tool    Tool     `xml:"tool"`
}

Header : http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#header

type Option

type Option func(x *XLIFF)

Option ...

func DataTypeOption

func DataTypeOption(dataType string) Option

DataTypeOption ...

func SourceLanguageOption

func SourceLanguageOption(tag language.Tag) Option

SourceLanguageOption ...

func TargetLanguageOption

func TargetLanguageOption(tag language.Tag) Option

TargetLanguageOption ...

func ToolOption

func ToolOption(id, name, version, company string) Option

ToolOption ...

func UseUTF16BEXMLEncodingOption

func UseUTF16BEXMLEncodingOption() Option

UseUTF16BEXMLEncodingOption ...

func UseUTF16LEXMLEncodingOption

func UseUTF16LEXMLEncodingOption() Option

UseUTF16LEXMLEncodingOption ...

func UseUTF8XMLEncodingOption

func UseUTF8XMLEncodingOption() Option

UseUTF8XMLEncodingOption ...

type Segment

type Segment struct {
	Lang    string `xml:"http://www.w3.org/XML/1998/namespace lang,attr"`
	Content string `xml:",innerxml"`
}

Segment ...

type Tool

type Tool struct {
	XMLName xml.Name `xml:"tool"`
	// The tool-id attribute allows unique identification of a <tool> element.
	// It is also used in other elements in the file to refer to the given <tool> element.
	ID string `xml:"tool-id,attr"`
	// The tool-name attribute specifies the name of a given tool.
	Name string `xml:"tool-name,attr"`
	// The tool-version attribute specifies the version of a given tool.
	Version string `xml:"tool-version,attr,omitempty"`
	// The tool-company attribute specifies the company from which a tool originates.
	Company string `xml:"tool-company,attr,omitempty"`
}

Tool : http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#tool_elem

type TransUnit

type TransUnit struct {
	XMLName  xml.Name `xml:"trans-unit"`
	XMLSpace string   `xml:"http://www.w3.org/XML/1998/namespace space,attr"`
	ID       string   `xml:"id,attr,omitempty"`
	// Source text - The <source> element is used to delimit a unit of text that could be a paragraph,
	// a title, a menu item, a caption, etc. The content of the <source> is generally the translatable text,
	// depending upon the translate attribute of the parent <trans-unit>.
	// The optional xml:lang attribute is used to specify the content language of the <source>;
	// this should always match source-language as a child of <trans-unit> but can vary as a child of <alt-trans>.
	// The optional ts attribute was DEPRECATED in XLIFF 1.1.
	Source *Segment `xml:"source"`
	// Target - The <target> element contains the translation of the content of the sibling <source> element.
	// The optional state and state-qualifier attributes indicate in which state the <target> is.
	// The optional phase-name attribute references the <phase> in which the <target> was last modified.
	// The optional xml:lang attribute is used to specify the content language of the <target>;
	// this should always match target-language as a child of <trans-unit> but can vary as a child of <alt-trans>.
	// The optional coord, font, css-style, style, and exstyle attributes describe the resource contained within the <target>;
	// these are the modifiable attributes for the <trans-unit> depending upon the reformat attribute of the parent <trans-unit>.
	// The optional equiv-trans describes if the target language translation is a direct equivalent of the source text.
	// The optional ts attribute was DEPRECATED in XLIFF 1.1.
	// The restype attribute is DEPRECATED in XLIFF 1.2, since <target> will always be of the same restype as its parent <trans-unit> or <alt-trans>.
	// A list of preferred values for the restype, state, and state-qualifier attributes are provided by this specification.
	Target *Segment `xml:"target"`
	// Note - The <note> element is used to add localization-related comments to the XLIFF document.
	// The content of <note> may be instructions from developers about how to handle the <source>,
	// comments from the translator about the translation, or any comment from anyone involved in processing the XLIFF file.
	// The optional xml:lang attribute specifies the language of the note content.
	// The optional from attribute indicates who entered the note.
	// The optional priority attribute allows a priority from 1 (high) to 10 (low) to be assigned to the note.
	// The optional annotates attribute indicates if the note is a general note or, in the case of a <trans-unit>,
	// pertains specifically to the <source> or the <target> element.
	Note []*Segment `xml:"note"`
}

TransUnit : http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#trans-unit

type Unit

type Unit struct {
	Text  string
	Notes []string
}

Unit ...

type XLIFF

type XLIFF struct {
	XMLName  xml.Name `xml:"xliff"`
	XMLNS    string   `xml:"xmlns,attr"`
	XMLSpace string   `xml:"http://www.w3.org/XML/1998/namespace space,attr"`
	Version  string   `xml:"version,attr"`
	File     File     `xml:"file"`

	tm.TM
}

XLIFF ...

func (*XLIFF) AddTransUnit

func (x *XLIFF) AddTransUnit(id string, source, target *Unit) error

AddTransUnit ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL