language

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: 1 Imported by: 22

Documentation

Overview

Package language defines languages that implement CLDR pluralization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(l *Language)

Register adds Language l to the collection of available languages.

Types

type Language

type Language struct {
	ID               string
	Name             string
	PluralCategories map[plural.Category]struct{}
	PluralFunc       func(*plural.Operands) plural.Category
}

Language is a written human language.

Languages are identified by tags defined by RFC 5646.

Typically language tags are a 2 character language code (ISO 639-1) optionally followed by a dash and a 2 character country code (ISO 3166-1). (e.g. en, pt-BR)

A Language implements CLDR plural rules as defined here: http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html http://unicode.org/reports/tr35/tr35-numbers.html#Operands

func LanguageWithID

func LanguageWithID(id string) *Language

LanguageWithID returns the language identified by id or nil if the language is not registered.

func (*Language) PluralCategory

func (l *Language) PluralCategory(number interface{}) (plural.Category, error)

PluralCategory returns the plural category for number as defined by the language's CLDR plural rules.

func (*Language) String

func (l *Language) String() string

Source Files

Jump to

Keyboard shortcuts

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