anime title language added
This commit is contained in:
parent
0a28c6b415
commit
5e9f052f86
31
anime_title_language.go
Normal file
31
anime_title_language.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AnimeTitleLang string
|
||||||
|
|
||||||
|
const (
|
||||||
|
AnimeTitleLangEnglish AnimeTitleLang = "english"
|
||||||
|
AnimeTitleLangNative AnimeTitleLang = "native"
|
||||||
|
AnimeTitleLangRomaji AnimeTitleLang = "romaji"
|
||||||
|
AnimeTitleUserPreferred AnimeTitleLang = "user-preferred"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ParseAnimeTitleLang(str string) (AnimeTitleLang, error) {
|
||||||
|
lang := AnimeTitleLang(strings.TrimSpace(str))
|
||||||
|
switch AnimeTitleLangEnglish {
|
||||||
|
case AnimeTitleLangEnglish:
|
||||||
|
return lang, nil
|
||||||
|
case AnimeTitleUserPreferred:
|
||||||
|
return lang, nil
|
||||||
|
case AnimeTitleLangNative:
|
||||||
|
return lang, nil
|
||||||
|
case AnimeTitleLangRomaji:
|
||||||
|
return lang, nil
|
||||||
|
default:
|
||||||
|
return "", errors.New("invalid anime title language")
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user