You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
481 B
23 lines
481 B
6 months ago
|
package utils
|
||
|
|
||
|
import (
|
||
|
"shop-api/global"
|
||
|
"shop-api/model"
|
||
|
)
|
||
|
|
||
|
func InterTranslate(original, form, to string) string {
|
||
|
data := global.MG_Language.(map[string]model.Internationalization)
|
||
|
if data[original].En != "" {
|
||
|
return data[original].En
|
||
|
}
|
||
|
go func() {
|
||
|
var data model.Internationalization
|
||
|
global.MG_DB.Model(&model.Internationalization{}).Where("ch=?", original).Find(&data)
|
||
|
if data.ID == 0 {
|
||
|
data.Ch = original
|
||
|
global.MG_DB.Create(&data)
|
||
|
}
|
||
|
}()
|
||
|
return ""
|
||
|
}
|