mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
🎨 i18n Bazaar package
This commit is contained in:
parent
54dcde6b48
commit
2ceb5f36d5
8 changed files with 37 additions and 2 deletions
|
|
@ -74,6 +74,7 @@ type Package struct {
|
|||
I18N []string `json:"i18n"`
|
||||
|
||||
PreferredFunding string `json:"preferredFunding"`
|
||||
PreferredName string `json:"preferredName"`
|
||||
PreferredDesc string `json:"preferredDesc"`
|
||||
|
||||
Name string `json:"name"`
|
||||
|
|
@ -147,6 +148,29 @@ func getPreferredReadme(readme *Readme) string {
|
|||
return ret
|
||||
}
|
||||
|
||||
func getPreferredName(pkg *Package) string {
|
||||
if nil == pkg.DisplayName {
|
||||
return pkg.Name
|
||||
}
|
||||
|
||||
ret := pkg.DisplayName.Default
|
||||
switch util.Lang {
|
||||
case "zh_CN":
|
||||
if "" != pkg.DisplayName.ZhCN {
|
||||
ret = pkg.DisplayName.ZhCN
|
||||
}
|
||||
case "en_US":
|
||||
if "" != pkg.DisplayName.EnUS {
|
||||
ret = pkg.DisplayName.EnUS
|
||||
}
|
||||
default:
|
||||
if "" != pkg.DisplayName.EnUS {
|
||||
ret = pkg.DisplayName.EnUS
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func getPreferredDesc(desc *Description) string {
|
||||
if nil == desc {
|
||||
return ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue