locale

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package locale contains definition of commonly used locales.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(locale Locale, formatters Formatters)

Register registers a new set of formatters for the given locale

Types

type Formatter

type Formatter func(d time.Duration) string

Formatter is a function for formatting an output string for given time duration

type Formatters

type Formatters map[time.Duration]Formatter

Formatters is a collection of formatter functions mapped to the closest time duration

func Lookup

func Lookup(locale Locale) Formatters

Lookup performs a lookup on the shared locales table and returns formatter for the given locale, else nil of none is found.

type Locale

type Locale string

Locale represents an IETF BCP 47 formatted language tag.

func (Locale) Split

func (locale Locale) Split() (string, string)

Split splits the locale into language and territory components. adapted from: https://github.com/jeandeaual/go-locale/blob/23669fb7cbc8f5714c70bc22594b8c0ff194ce5d/util.go#L13-L28

Jump to

Keyboard shortcuts

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