store

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocaleCatalog

type LocaleCatalog struct {
	//Tag is which locale was actually used to find these translations (e.g. I asked for en-US and am getting en)
	Tag language.Tag
	//Path is the filesystem path for the source of the catalog
	Path         string
	Translations map[string]*Translation
}

LocaleCatalog represents the translations provided by a TranslationStore

func NewLocaleCatalog

func NewLocaleCatalog(tag language.Tag) LocaleCatalog

NewLocaleCatalog creates an empty LocaleCatalog for the supplied language

type Translation

type Translation struct {
	ID, PluralID, String string
	Plurals              map[plural.Form]string
}

Translation is the struct for the Translations parsed via Po or Mo files and all coming parsers

func NewTranslation

func NewTranslation() *Translation

NewTranslation returns the initialized Translation

func (*Translation) Get

func (t *Translation) Get() string

Get returns the string of the translation

func (*Translation) GetPlural

func (t *Translation) GetPlural(form plural.Form) string

GetPlural returns the requested plural form, if available

type TranslationStore

type TranslationStore interface {
	GetTranslations(tag language.Tag) (LocaleCatalog, error)
}

TranslationStore is implemented by packages that offer a way to load translations.

Directories

Path Synopsis
gotextstore module

Jump to

Keyboard shortcuts

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