Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 644 Bytes

README.md

File metadata and controls

39 lines (27 loc) · 644 Bytes

go-locale

Build Status

Simple package to determine best locale based on a proper Accept-Language header.

Install

go get github.com/swhite24/go-locale/locale

Usage

package main

import(
    "github.com/swhite24/go-locale/locale"
)

func main() {
    // Pass a proper accept-language header
    ls := locale.Read("en-US,en;q=0.8")

    // Ask which is best
    l := ls.Best()
    fmt.Println(l)

    // Prints:
    // en_US
}

TODO

Add support for determining best based on a list of supported locale definitions.