add i18n support

This commit is contained in:
landaiqing
2024-11-12 22:59:39 +08:00
parent 97ca3fc7b0
commit ae743ba8a6
62 changed files with 4468 additions and 2797 deletions

21
common/i18n/keys.go Normal file
View File

@@ -0,0 +1,21 @@
package i18n
const I18nKey = "i18n"
const I18nCurrentLangKey = "lang"
var (
defaultLangHeaderKey = "Accept-Language"
defaultErrCode uint32 = 10001
)
// SetDefaultLangHeaderKey sets the default value of the lang header key.
// need to be set before use
func SetDefaultLangHeaderKey(key string) {
defaultLangHeaderKey = key
}
// SetDefaultErrCode sets the default value of the err code.
// need to be set before use
func SetDefaultErrCode(code uint32) {
defaultErrCode = code
}