acceptlang

package
v0.0.0-...-1fbbad1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2016 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

https://github.com/martini-contrib/acceptlang

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptLanguage

type AcceptLanguage struct {
	Language string
	Quality  float32
}

A single language from the Accept-Language HTTP header.

type AcceptLanguages

type AcceptLanguages []AcceptLanguage

A slice of sortable AcceptLanguage instances.

func Read

func Read(lang string) AcceptLanguages

The parsed structure is a slice of Accept-Language values stored in an AcceptLanguages instance, sorted based on the language qualifier.

func ReadHeader

func ReadHeader(header http.Header) AcceptLanguages

func (AcceptLanguages) Best

func (al AcceptLanguages) Best() AcceptLanguage

Returns the language with the highest quality score

func (AcceptLanguages) Len

func (al AcceptLanguages) Len() int

Returns the total number of items in the slice. Implemented to satisfy sort.Interface.

func (AcceptLanguages) Less

func (al AcceptLanguages) Less(i, j int) bool

Determines whether or not the item at position i is "less than" the item at position j. Implemented to satisfy sort.Interface.

func (AcceptLanguages) String

func (al AcceptLanguages) String() string

Returns the parsed languages in a human readable fashion.

func (AcceptLanguages) Swap

func (al AcceptLanguages) Swap(i, j int)

Swaps the items at position i and j. Implemented to satisfy sort.Interface.

Jump to

Keyboard shortcuts

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