Help us shape the future of Go! Take the 2026 Go Developer Survey

i18n

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package i18n answers the words and dates a language reads on the public site.

Index

Constants

View Source
const DefaultLocale = "en-US"

DefaultLocale is the language the sources are written in.

Variables

View Source
var DatePattern = Msgid("{day} {month} {year}")

DatePattern is the order a date reads in, naming each part it takes.

Functions

func Msgid

func Msgid(s string) string

Msgid marks a message for extraction and returns it unchanged.

Types

type Translator

type Translator struct {
	// contains filtered or unexported fields
}

Translator answers the words one language reads.

func For

func For(locale string) *Translator

For returns the translator a language reads with.

func (*Translator) Date

func (t *Translator) Date(at time.Time) string

Date returns the date as the translator's language writes it.

func (*Translator) Get

func (t *Translator) Get(msgid string) string

Get returns the message in the translator's language, the source word when it carries none.

Jump to

Keyboard shortcuts

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