26 lines
594 B
Go
26 lines
594 B
Go
package iso639
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// GetLanguageNameForISO639Code tries get the language name for an ISO 639-1, ISO 639-2/B or ISO 639-2/T code
|
|
func GetLanguageNameForISO639Code(s string) (string, error) {
|
|
languageName, err := GetLanguageNameForISO639_1Code(s)
|
|
if err == nil {
|
|
return languageName, nil
|
|
}
|
|
|
|
languageName, err = GetLanguageNameForISO639_2BCode(s)
|
|
if err == nil {
|
|
return languageName, nil
|
|
}
|
|
|
|
languageName, err = GetLanguageNameForISO639_2TCode(s)
|
|
if err == nil {
|
|
return languageName, nil
|
|
}
|
|
|
|
return "", fmt.Errorf("no language name found for ISO 639 code: %s", s)
|
|
}
|