iso639_3

package module
v1.0.0 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: 5

README

ISO 639-3

Go Reference Test Go Report Card

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

Motivation

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

Data source

Database is generated (see cmd/generator.go) from official ISO 639-3 data. See official site of the ISO 639-3 Registration Authority for details.

Installation

go get github.com/barbashov/iso639-3

Examples

iso639_3.LanguagesPart3 // returns ISO 639-3 languages lookup table
iso639_3.LanguagesPart2 // returns ISO 639-2 languages lookup table
iso639_3.LanguagesPart1 // returns ISO 639-1 languages lookup table

iso639_3.FromAnyCode("eng") // returns object representing English language looking through ISO 639-3, ISO 639-2 and ISO 639-1 codes
iso639_3.FromPart3Code("deu") // returns object representing German language looking by ISO 639-3 code
iso639_3.FromPart2Code("ger") // returns object representing German language looking by ISO 639-2 code
iso639_3.FromPart1Code("de") // returns object representing German language looking by ISO 639-1 code
iso639_3.FromName("English") // returns object representing English language looking by language name

Contribute

Feel free to open issues and send pull requests.

License

MIT

Documentation

Index

Constants

View Source
const (
	LanguageTypeIndividual    LanguageScope = 'I'
	LanguageTypeSpecial       LanguageScope = 'S'
	LanguageTypeMacrolanguage LanguageScope = 'M'

	LanguageScopeLiving      LanguageType = 'L'
	LanguageScopeHistorical  LanguageType = 'H'
	LanguageScopeAncient     LanguageType = 'A'
	LanguageScopeExtinct     LanguageType = 'E'
	LanguageScopeConstructed LanguageType = 'C'
	LanguageScopeSpecial     LanguageType = 'S'
)

Variables

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

LanguagesPart1 lookup table. Keys are ISO 639-1 codes

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

LanguagesPart2 lookup table. Keys are ISO 639-2 codes

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

LanguagesPart3 lookup table. Keys are ISO 639-3 codes

Functions

This section is empty.

Types

type Language

type Language struct {
	Part3        string // ISO639-3 code
	Part2B       string // ISO639-2 bibliographic code
	Part2T       string // ISO639-2 terminology code
	Part1        string // ISO639-1 code
	Scope        LanguageScope
	LanguageType LanguageType
	Name         string
	Comment      string
}

Language holds language info - all ISO 639 codes along with name and some additional info

func FromAnyCode

func FromAnyCode(code string) *Language

FromAnyCode looks up language for given code. For three-symbol codes it tries ISO639-3 first, then ISO639-2. For two-symbol codes it tries ISO639-1. Returns nil if not found

func FromName

func FromName(name string) *Language

FromName looks up language for given reference name. Returns nil if not found

func FromPart1Code

func FromPart1Code(code string) *Language

FromPart1Code looks up language for given ISO639-1 two-symbol code. Returns nil if not found

func FromPart2Code

func FromPart2Code(code string) *Language

FromPart2Code looks up language for given ISO639-2 (both bibliographic or terminology) three-symbol code. Returns nil if not found

func FromPart3Code

func FromPart3Code(code string) *Language

FromPart3Code looks up language for given ISO639-3 three-symbol code. Returns nil if not found

type LanguageScope

type LanguageScope rune

LanguageScope represents language scope as defined in ISO 639-3

type LanguageType

type LanguageType rune

LanguageType represents language scope as defined in ISO 639-3

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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