i18n

package
v0.0.0-...-430806f Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2013 License: MIT Imports: 5 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 Body

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

func (*Body) Add

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

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, error)

type Parser

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

type TransUnit

type TransUnit struct {
	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