po

package
v0.35.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Comments []string
	Value    string
}

Message represents a i18n message

type MessageCatalog

type MessageCatalog struct {
	Messages map[string]*Message
}

MessageCatalog is the catalog of i18n messages for a given locale

func Merge

func Merge(source MessageCatalog, destination MessageCatalog) MessageCatalog

Merge merges two message catalogs, preserving only keys present in source

func Parse

func Parse(filename string) MessageCatalog

Parse parses the PO file into a MessageCatalog

func ParseReader

func ParseReader(r io.Reader) MessageCatalog

ParseReader parses the PO file into a MessageCatalog

func (*MessageCatalog) Add

func (catalog *MessageCatalog) Add(id, value string, comment []string)

Add adds a new message in the i18n catalog

func (*MessageCatalog) AddMessage

func (catalog *MessageCatalog) AddMessage(id string, message Message)

AddMessage adds a new message in the i18n catalog

func (*MessageCatalog) SortedKeys

func (catalog *MessageCatalog) SortedKeys() []string

SortedKeys returns the sorted keys in the catalog

func (*MessageCatalog) Write

func (catalog *MessageCatalog) Write(w io.Writer)

Write writes the catalog in PO file format into w

Jump to

Keyboard shortcuts

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