i18n

package
v0.0.0-...-ec7f410 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2014 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package i18n implements a gettext based translation library with XLiff support

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateXliff

func CreateXliff(catalog Catalog, sourceLanguage, targetLanguage string) []byte

Types

type Alphabetically

type Alphabetically []TransUnit

func (Alphabetically) Len

func (a Alphabetically) Len() int

func (Alphabetically) Less

func (a Alphabetically) Less(i, j int) bool

func (Alphabetically) Swap

func (a Alphabetically) Swap(i, j int)

type Body

type Body struct {
	TransList []TransUnit `xml:"trans-unit"`
}

func (*Body) Add

func (b *Body) Add(source, target string)

func (*Body) SortAlphabetically

func (b *Body) SortAlphabetically()

type Catalog

type Catalog map[string]string

func XliffParser

func XliffParser(fp *os.File) (Catalog, error)

func (Catalog) String

func (catalog Catalog) String(message string) string

func (Catalog) StringN

func (catalog Catalog) StringN(msgid1, msgid2 string, n int) (tmsg string)

type File

type File struct {
	Body           Body   `xml:"body"`
	Original       string `xml:"original,attr"`
	Datatype       string `xml:"datatype,attr"`
	SourceLanguage string `xml:"source-language,attr"`
	TargetLanguage string `xml:"target-language,attr,omitempty"`
}

type LanguagesCatalog

type LanguagesCatalog map[string]Catalog

func LoadCatalogs

func LoadCatalogs(translationsPath string, parser Parser) LanguagesCatalog

type Parser

type Parser func(fp *os.File) (Catalog, error)

type TransUnit

type TransUnit struct {
	Id     string   `xml:"id,attr,omitempty"`
	Source string   `xml:"source"`
	Target string   `xml:"target"`
	Note   []string `xml:"note"`
}

type Xliff

type Xliff struct {
	XMLName xml.Name `xml:"xliff"`
	File    File     `xml:"file"`
	Version string   `xml:"version,attr"`
	Xmlns   string   `xml:"xmlns,attr"`
}

Jump to

Keyboard shortcuts

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