locale

package
Version: v0.0.0-...-a78190c Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2014 License: BSD-2-Clause-Views, MIT Imports: 4 Imported by: 44

Documentation

Overview

Package locale parses locale strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locale

type Locale struct {
	ID       string
	Language *language.Language
}

Locale is a language and a geographic region (e.g. en-US, en-GB).

func MustNew

func MustNew(s string) *Locale

MustNew is similar to New except that it panics if an error happens.

func New

func New(s string) (*Locale, error)

New searches s for a valid language tag (RFC 5646) of the form xx-YY or xx_YY where xx is a 2 character language code and YY is a 2 character country code.

It returns an error if s doesn't contain exactly one language tag or if the language represented by the tag is not supported by this package.

func (*Locale) String

func (l *Locale) String() string

Source Files

Jump to

Keyboard shortcuts

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