mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🎨 Add i18n settings in marketplace package https://github.com/siyuan-note/siyuan/issues/8177
This commit is contained in:
parent
089a8322c7
commit
f5f5a1d428
6 changed files with 34 additions and 0 deletions
|
|
@ -64,6 +64,7 @@ type Package struct {
|
|||
Description *Description `json:"description"`
|
||||
Readme *Readme `json:"readme"`
|
||||
Funding *Funding `json:"funding"`
|
||||
I18N []string `json:"i18n"`
|
||||
|
||||
PreferredFunding string `json:"preferredFunding"`
|
||||
PreferredDesc string `json:"preferredDesc"`
|
||||
|
|
@ -112,6 +113,29 @@ func parseFunding(pkg map[string]interface{}) (ret *Funding) {
|
|||
return
|
||||
}
|
||||
|
||||
func getPreferredDesc(desc *Description) string {
|
||||
if nil == desc {
|
||||
return ""
|
||||
}
|
||||
|
||||
ret := desc.Default
|
||||
switch util.Lang {
|
||||
case "zh_CN":
|
||||
if "" != desc.ZhCN {
|
||||
ret = desc.ZhCN
|
||||
}
|
||||
case "en_US":
|
||||
if "" != desc.EnUS {
|
||||
ret = desc.EnUS
|
||||
}
|
||||
default:
|
||||
if "" != desc.EnUS {
|
||||
ret = desc.EnUS
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func getPreferredFunding(funding *Funding) string {
|
||||
if nil == funding {
|
||||
return ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue