localization

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package localization provides experimental locale helpers for templates.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Default is the fallback Localizer used when no localizer is configured.
	Default = Localizer(defaultLocalizer{locale: "en_US"})
)

Functions

func FuncMap

func FuncMap() template.FuncMap

FuncMap returns placeholders for localization template helpers.

func Locale

func Locale(ctx ...*partial.RenderContext) string

Locale returns the configured locale for a render context.

go-doc:sig func() string

func Stage

func Stage() partial.RenderStage

Stage installs locale and localizer template helpers.

func WithLocalizer

func WithLocalizer(ctx context.Context, localizer Localizer) context.Context

WithLocalizer stores a Localizer on a context.

Types

type Localizer

type Localizer interface {
	GetLocale() string
}

Localizer provides the active locale for a render.

func FromContext

func FromContext(ctx context.Context) Localizer

FromContext returns the configured Localizer or Default.

func LocalizerValue

func LocalizerValue(ctx ...*partial.RenderContext) Localizer

LocalizerValue returns the configured localizer for a render context.

go-doc:sig func() github.com/donseba/go-partial/exp/localization.Localizer

Jump to

Keyboard shortcuts

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