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

goacceptlanguageparser

package module
v0.0.0-...-7224a0c Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2016 License: BSD-3-Clause Imports: 3 Imported by: 2

README

goacceptlanguageparser

Go library for parsing HTTP request header "Accept-Language".

Installation

$ go get github.com/strukturag/goacceptlanguageparser

Run Python example

$ python python/acceptlanguageparser.py

Run unit tests

$ go test -v

Run benchmarks

$ go test -cpuprofile=/tmp/cpu.out -bench .

View cpu profile

$ go tool pprof --text goacceptlanguageparser.test /tmp/cpu.out

Replace --text with --callgrind or to create a callgrind format file.

Contributing

  1. "Fork".
  2. Make a feature branch.
  3. Make changes.
  4. Do your commits (run go fmt before commit).
  5. Send "pull request".

License

goacceptlanguageparser uses a BSD-style license, see our LICENSE file.

Documentation

Overview

Package goacceptlanguageparser supports HTTP 1.1 content language negotiation.

In particular, it provides functionality for parsing the contents of the Accept-Language header as described in RFC2616 section 14.4.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAcceptLanguage

func ParseAcceptLanguage(languages string, supportedLanguages []string) []string

ParseAcceptLanguage returns RFC1766 language codes parsed and sorted from languages.

If supportedLanguages is not empty, the returned codes will be filtered by its contents.

Types

This section is empty.

Jump to

Keyboard shortcuts

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