Skip to content

Commit

Permalink
Merge pull request #28 from TibbyRocks/bugfix/translation-crash
Browse files Browse the repository at this point in the history
Add language override/fallback, add fix for zh-TW
  • Loading branch information
mozoarella authored Feb 18, 2024
2 parents 4f135fc + 960137e commit 11d1f49
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,17 @@ If the language is not supported you get an empty slice.
func GetLanguageByCode(code string) []string {
var response []string

var overrideMap map[string]string = make(map[string]string)
overrideMap["zh-TW"] = "zh-Hant"

if val, ok := overrideMap[code]; ok {
code = val
}

if val, ok := languageMap[code]; ok {
response = append(response, val.name, val.nativeName)
} else {
response = append(response, "unsupported "+code, "unsupported "+code)
}

return response
Expand Down

0 comments on commit 11d1f49

Please sign in to comment.