Skip to content

Package locale provides logic for parsing and interacting with the Accept-Language HTTP header

License

Notifications You must be signed in to change notification settings

swhite24/go-locale

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Package locale provides logic for parsing and interacting with the Accept-Language HTTP header

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages