lang

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: AGPL-3.0 Imports: 3 Imported by: 14

Documentation

Overview

Package lang provides definitions to specify translation language for template selection and output rendering.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Default language (hard to get around)
	Default = "eng" // ISO639-3
)

Functions

This section is empty.

Types

type Language

type Language struct {
	Code string
	Name string
}

Language is used to set and get language translation to be used for rendering output.

func LanguageFromCode

func LanguageFromCode(code string) (Language, error)

LanguageFromCode returns a Language object from the given ISO-639-3 (three-letter) code.

Will fail if an unknown code is provided.

func LanguageFromContext added in v0.3.0

func LanguageFromContext(ctx context.Context) (Language, bool)

LanguageFromContext scans the given context for a valid language specification, and if found returns a corresponding language object.

func (Language) String

func (l Language) String() string

String implements the String interface.

Returns a representation of the Language fit for debugging.

Jump to

Keyboard shortcuts

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