language

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CodeToLanguageName = make(map[string]string)
View Source
var ISO639_3_To_1 = map[string]string{
	"afr": "af", "amh": "am", "ara": "ar", "hye": "hy", "asm": "as", "aze": "az",
	"bel": "be", "ben": "bn", "bos": "bs", "bul": "bg", "mya": "my", "cat": "ca",
	"cmn": "zh", "nya": "ny", "hrv": "hr", "ces": "cs", "dan": "da", "nld": "nl",
	"eng": "en", "est": "et", "fin": "fi", "fra": "fr", "ful": "ff", "glg": "gl",
	"lug": "lg", "kat": "ka", "deu": "de", "ell": "el", "guj": "gu", "hau": "ha",
	"heb": "he", "hin": "hi", "hun": "hu", "isl": "is", "ibo": "ig", "ind": "id",
	"gle": "ga", "ita": "it", "jpn": "ja", "jav": "jv", "kan": "kn", "kaz": "kk",
	"khm": "km", "kor": "ko", "kur": "ku", "kir": "ky", "lao": "lo", "lav": "lv",
	"lin": "ln", "lit": "lt", "ltz": "lb", "mkd": "mk", "msa": "ms", "mal": "ml",
	"mlt": "mt", "zho": "zh", "mri": "mi", "mar": "mr", "mon": "mn", "nep": "ne",
	"nor": "no", "oci": "oc", "ori": "or", "pus": "ps", "fas": "fa", "pol": "pl",
	"por": "pt", "pan": "pa", "ron": "ro", "rus": "ru", "srp": "sr", "sna": "sn",
	"snd": "sd", "slk": "sk", "slv": "sl", "som": "so", "spa": "es", "swa": "sw",
	"swe": "sv", "tam": "ta", "tgk": "tg", "tel": "te", "tha": "th", "tur": "tr",
	"ukr": "uk", "urd": "ur", "uzb": "uz", "vie": "vi", "cym": "cy", "wol": "wo",
	"xho": "xh", "zul": "zu",
}
View Source
var LanguageNamesToCode = map[string]string{
	"afrikaans": "af", "albanian": "sq", "amharic": "am", "arabic": "ar",
	"armenian": "hy", "azerbaijani": "az", "basque": "eu", "belarusian": "be",
	"bengali": "bn", "bosnian": "bs", "bulgarian": "bg", "burmese": "my",
	"catalan": "ca", "chinese": "zh", "croatian": "hr", "czech": "cs",
	"danish": "da", "dutch": "nl", "english": "en", "estonian": "et",
	"finnish": "fi", "french": "fr", "galician": "gl", "georgian": "ka",
	"german": "de", "greek": "el", "gujarati": "gu", "hausa": "ha",
	"hebrew": "he", "hindi": "hi", "hungarian": "hu", "icelandic": "is",
	"indonesian": "id", "irish": "ga", "italian": "it", "japanese": "ja",
	"javanese": "jv", "kannada": "kn", "kazakh": "kk", "khmer": "km",
	"korean": "ko", "kurdish": "ku", "kyrgyz": "ky", "lao": "lo",
	"latvian": "lv", "lingala": "ln", "lithuanian": "lt", "luxembourgish": "lb",
	"macedonian": "mk", "malay": "ms", "malayalam": "ml", "maltese": "mt",
	"maori": "mi", "marathi": "mr", "mongolian": "mn", "nepali": "ne",
	"norwegian": "no", "occitan": "oc", "oriya": "or", "pashto": "ps",
	"persian": "fa", "polish": "pl", "portuguese": "pt", "punjabi": "pa",
	"romanian": "ro", "russian": "ru", "serbian": "sr", "shona": "sn",
	"sindhi": "sd", "slovak": "sk", "slovene": "sl", "slovenian": "sl",
	"somali": "so", "spanish": "es", "swahili": "sw", "swedish": "sv",
	"tagalog": "tl", "tamil": "ta", "tajik": "tg", "telugu": "te",
	"thai": "th", "turkish": "tr", "ukrainian": "uk", "urdu": "ur",
	"uzbek": "uz", "vietnamese": "vi", "welsh": "cy", "wolof": "wo",
	"xhosa": "xh", "yoruba": "yo", "zulu": "zu",
}

Functions

func ISO added in v0.0.15

func ISO(code string) string

ISO returns the ISO 639-1 language tag with the first region subtag.

func Language added in v0.0.15

func Language(code string) string

Language returns the base ISO 639-1 language code when the normalized tag starts with a mappable ISO 639-3 subtag.

func NormalizeLanguage

func NormalizeLanguage(code string) string

NormalizeLanguage normalizes a language code/name to BCP-47 format.

func Region added in v0.0.15

func Region(code string) string

Region returns the first two-letter region subtag, or an empty string when the normalized language tag has no region.

func ToLanguageName added in v0.0.15

func ToLanguageName(code string) string

ToLanguageName returns the English language name for the base language code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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