tartrazine/alias.go

16 lines
328 B
Go
Raw Normal View History

package slinguist
import "strings"
2017-05-10 11:09:51 +00:00
// GetLanguageByAlias returns the language related to the given alias or Otherlanguage otherwise.
func GetLanguageByAlias(alias string) (lang string) {
a := strings.Split(alias, `,`)[0]
a = strings.ToLower(a)
lang, ok := languagesByAlias[a]
if !ok {
lang = OtherLanguage
}
return
}