language

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 8 Imported by: 1

README

language

Languages codes

Documentation

Index

Constants

View Source
const UnknownLanguageCode = "?"

Variables

This section is empty.

Functions

func IndexToCode

func IndexToCode(index Index) string

IndexToCode returns language code.

func IsLanguageName

func IsLanguageName(b []byte) bool

func Supported

func Supported() []string

Supported returns code of supported languages.

func TranslationResource

func TranslationResource(dir string, langfilename string, customSuffixes ...string) ([]string, error)

Types

type Index

type Index int

Index is integer representative of language short code.

const Unknown Index = -1

Unknown value is used if language code is not found.

func Parse added in v0.1.0

func Parse(lang string) Index

Parse returns index of language code, if not found returns -1.

func ToIndex

func ToIndex(lang string) Index

ToIndex returns index by language code: ru, en, sr, cz, created new if not found.

type Name

type Name []string

Name holds decoded names. Index of the slice calculates by ToIndex().

func ToName

func ToName(b []byte) (Name, error)

Name decodes jsonb into array of strings

func (*Name) Byte

func (rn *Name) Byte() []byte

func (Name) Elem added in v0.1.0

func (n Name) Elem(index Index) string

Elem

func (*Name) MarshalJSON

func (n *Name) MarshalJSON() ([]byte, error)

func (*Name) Scan

func (n *Name) Scan(value interface{}) error

Scan implements database/sql Scanner interface.

func (*Name) UnmarshalJSON

func (n *Name) UnmarshalJSON(buf []byte) error

func (*Name) Value

func (n *Name) Value() (driver.Value, error)

Value implements interface sql.Valuer

type NameColumn

type NameColumn []byte

NameColumn is a type of column Name in regular reference table

func (NameColumn) Name

func (rn NameColumn) Name() (Name, error)

Name decodes jsonb into array of strings

Jump to

Keyboard shortcuts

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