messages

package
v0.0.0-...-ba7cdbd Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2014 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package messages implements functions for extracting messages from source code files and compiling them to Go code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(filename string, translations []*po.Po, opts *CompileOptions) error

func DefaultTagFields

func DefaultTagFields() []string

func DefaultTypes

func DefaultTypes() []string

func Write

func Write(w io.Writer, messages []*Message) error

Types

type CompileOptions

type CompileOptions struct {
	DefaultContext string
}

type ExtractOptions

type ExtractOptions struct {
	Functions []*Function
	Types     []string
	TagFields []string
}

func DefaultExtractOptions

func DefaultExtractOptions() *ExtractOptions

type Function

type Function struct {
	// Qualified function name
	Name string
	// Wheter the function is a template function
	Template bool
	// Wheter the function has a context argument
	Context bool
	// Wheter the function has a plural form argument
	Plural bool
	// Position of the first translatable argument (0 indexed)
	Start int
}

func DefaultFunctions

func DefaultFunctions() []*Function

type Message

type Message struct {
	Context           string
	Singular          string
	Plural            string
	TranslatorComment string
	Positions         []*Position
	Translations      []string
}

func Extract

func Extract(dir string, opts *ExtractOptions) ([]*Message, error)

func (*Message) Key

func (m *Message) Key() string

func (*Message) Merge

func (m *Message) Merge(o *Message, pos *Position) error

func (*Message) String

func (m *Message) String() string

type Position

type Position struct {
	Filename string
	Line     int
	Comment  string
}

func (*Position) String

func (p *Position) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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