优化从文件读取

This commit is contained in:
Yun
2024-07-10 17:24:58 +08:00
parent 3e2c5daf3e
commit 9d844ed7d4
7 changed files with 97 additions and 4 deletions
+4
View File
@@ -0,0 +1,4 @@
{
"success":200,
"error":400
}
+4
View File
@@ -0,0 +1,4 @@
{
"success":"Success",
"error":"Error #msg#"
}
+4
View File
@@ -0,0 +1,4 @@
{
"success":"成功",
"error":"失败 #msg#"
}
+18
View File
@@ -0,0 +1,18 @@
package main
import (
"fmt"
"github.com/yuninks/langx"
)
func main() {
langx.RegisterDir("./lang")
code, msg := langx.GetTrans("zh", "success", map[string]string{})
fmt.Println(code, msg)
code, msg = langx.GetTrans("en", "error", map[string]string{
"msg":"这是失败的原因",
})
fmt.Println(code, msg)
}