iso639_2

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

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

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 0 Imported by: 0

README

Deprecated

Please use https://github.com/barbashov/iso639-3 instead.

ISO 639-2

Go Reference Test Go Report Card

A database of ISO 639-2 and ISO 639-1 languages.

Generated from official ISO 639-2 list, so no native names, unfortunately :(

Motivation

There's an excellent Go library for ISO 639-1, but it lacks ISO 639-2 codes.

Data source

Database is generated (see cmd/generator.go) from official ISO 639-2 data. See The Library of Congress website for details.

Installation

go get github.com/barbashov/iso639-2

Examples

iso639_2.Languages // returns languages lookup table

iso639_2.FromCode("eng") // returns object representing English language
iso639_2.FromEnglishName("English") // returns object representing English language
iso639_2.FromFrenchName("anglais") // returns object representing English language

Contribute

Feel free to open issues and send pull requests.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Languages = map[string]Language{}/* 671 elements not displayed */

Languages lookup table. Keys are ISO 639-1 and ISO 639-2 codes

Functions

This section is empty.

Types

type Language

type Language struct {
	Alpha3  string   // ISO 639-2 Alpha-3 code
	Alpha2  string   // ISO 639-1 Alpha-2 code
	English []string // English names of a language
	French  []string // French names of a language
}

Language holds language information

func FromCode

func FromCode(code string) *Language

FromCode looks up language for given ISO639-1 or ISO639-2 code. Returns nil if not found

func FromEnglishName

func FromEnglishName(name string) *Language

FromEnglishName looks up language for given english name. Returns nil if not found

func FromFrenchName

func FromFrenchName(name string) *Language

FromFrenchName looks up language for given french name. Returns nil if not found

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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