jibber_jabber

package module
v0.0.0-...-bcc4c83 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

README

Jibber Jabber Build Status

Jibber Jabber is a GoLang Library that can be used to detect an operating system's current language.

OS Support

OSX and Linux via the LC_ALL and LANG environment variables. These are standard variables that are used in ALL versions of UNIX for language detection.

Windows via GetUserDefaultLocaleName and GetSystemDefaultLocaleName system calls. These calls are supported in Windows Vista and up.

Usage

Add the following line to your go import:

	"github.com/cloudfoundry/jibber_jabber"
DetectIETF

DetectIETF will return the current locale as a string. The format of the locale will be the ISO 639 two-letter language code, a DASH, then an ISO 3166 two-letter country code.

	userLocale, err := jibber_jabber.DetectIETF()
	println("Locale:", userLocale)
DetectLanguage

DetectLanguage will return the current languge as a string. The format will be the ISO 639 two-letter language code.

	userLanguage, err := jibber_jabber.DetectLanguage()
	println("Language:", userLanguage)
DetectTerritory

DetectTerritory will return the current locale territory as a string. The format will be the ISO 3166 two-letter country code.

	localeTerritory, err := jibber_jabber.DetectTerritory()
	println("Territory:", localeTerritory)
Errors

All the Detect commands will return an error if they are unable to read the Locale from the system.

For Windows, additional error information is provided due to the nature of the system call being used.

Documentation

Index

Constants

View Source
const (
	COULD_NOT_DETECT_PACKAGE_ERROR_MESSAGE = "Could not detect Language"
)

Variables

This section is empty.

Functions

func DetectIETF

func DetectIETF() (locale string, err error)

func DetectLanguage

func DetectLanguage() (language string, err error)

func DetectTerritory

func DetectTerritory() (territory string, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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