邮件多语言
This commit is contained in:
parent
c8f859d7e4
commit
39cf03a4ab
@ -6,23 +6,27 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CFG_LANGUAGE = "LanguageData"
|
CFG_LANGUAGE = "LanguageData"
|
||||||
|
CFG_ALLLANGUAGE = "AllLanguage"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
gamedata.InitCfg(CFG_LANGUAGE)
|
gamedata.InitCfg(CFG_LANGUAGE)
|
||||||
|
gamedata.InitCfg(CFG_ALLLANGUAGE)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetLanguage(lang msg.LANG_TYPE, key string) string {
|
func GetLanguage(lang msg.LANG_TYPE, key string) string {
|
||||||
data, err := gamedata.GetDataByKey(CFG_LANGUAGE, key)
|
data, err := gamedata.GetDataByKey(CFG_ALLLANGUAGE, key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
switch lang {
|
switch lang {
|
||||||
case msg.LANG_TYPE_LANG_EN:
|
case msg.LANG_TYPE_LANG_EN:
|
||||||
return gamedata.GetStringValue(data, "English")
|
return gamedata.GetStringValue(data, "en_US")
|
||||||
case msg.LANG_TYPE_LANG_PTBR:
|
case msg.LANG_TYPE_LANG_PTBR:
|
||||||
return gamedata.GetStringValue(data, "pt_BR")
|
return gamedata.GetStringValue(data, "pt_BR")
|
||||||
|
case msg.LANG_TYPE_LANG_CN:
|
||||||
|
return gamedata.GetStringValue(data, "zh_CN")
|
||||||
default:
|
default:
|
||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user