mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Bazaar i18n
This commit is contained in:
parent
eb91448934
commit
b3e85eb567
8 changed files with 27 additions and 19 deletions
|
|
@ -397,7 +397,7 @@ export const bazaar = {
|
||||||
</div>`;
|
</div>`;
|
||||||
if (dataObj.downloaded) {
|
if (dataObj.downloaded) {
|
||||||
const mdElement = readmeElement.querySelector(".item__readme");
|
const mdElement = readmeElement.querySelector(".item__readme");
|
||||||
mdElement.innerHTML = data.readme;
|
mdElement.innerHTML = data.preferredReadme;
|
||||||
highlightRender(mdElement);
|
highlightRender(mdElement);
|
||||||
} else {
|
} else {
|
||||||
fetchPost("/api/bazaar/getBazaarPackageREAME", {
|
fetchPost("/api/bazaar/getBazaarPackageREAME", {
|
||||||
|
|
|
||||||
2
app/src/types/index.d.ts
vendored
2
app/src/types/index.d.ts
vendored
|
|
@ -709,8 +709,8 @@ declare interface IBazaarItem {
|
||||||
enabled: boolean
|
enabled: boolean
|
||||||
preferredName: string
|
preferredName: string
|
||||||
preferredDesc: string
|
preferredDesc: string
|
||||||
|
preferredReadme: string
|
||||||
iconURL: string
|
iconURL: string
|
||||||
readme: string
|
|
||||||
stars: string
|
stars: string
|
||||||
author: string
|
author: string
|
||||||
updated: string
|
updated: string
|
||||||
|
|
|
||||||
|
|
@ -142,13 +142,14 @@ func InstalledIcons() (ret []*Icon) {
|
||||||
installSize, _ := util.SizeOfDirectory(installPath)
|
installSize, _ := util.SizeOfDirectory(installPath)
|
||||||
icon.InstallSize = installSize
|
icon.InstallSize = installSize
|
||||||
icon.HInstallSize = humanize.Bytes(uint64(installSize))
|
icon.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||||
readme, readErr := os.ReadFile(filepath.Join(installPath, "README.md"))
|
readmeFilename := getPreferredReadme(icon.Readme)
|
||||||
|
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||||
if nil != readErr {
|
if nil != readErr {
|
||||||
logging.LogWarnf("read install icon README.md failed: %s", readErr)
|
logging.LogWarnf("read installed README.md failed: %s", readErr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
icon.README, _ = renderREADME(icon.URL, readme)
|
icon.PreferredReadme, _ = renderREADME(icon.URL, readme)
|
||||||
icon.Outdated = isOutdatedIcon(icon, bazaarIcons)
|
icon.Outdated = isOutdatedIcon(icon, bazaarIcons)
|
||||||
ret = append(ret, icon)
|
ret = append(ret, icon)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ type Package struct {
|
||||||
PreferredFunding string `json:"preferredFunding"`
|
PreferredFunding string `json:"preferredFunding"`
|
||||||
PreferredName string `json:"preferredName"`
|
PreferredName string `json:"preferredName"`
|
||||||
PreferredDesc string `json:"preferredDesc"`
|
PreferredDesc string `json:"preferredDesc"`
|
||||||
|
PreferredReadme string `json:"preferredReadme"`
|
||||||
|
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
RepoURL string `json:"repoURL"`
|
RepoURL string `json:"repoURL"`
|
||||||
|
|
@ -84,8 +85,6 @@ type Package struct {
|
||||||
PreviewURLThumb string `json:"previewURLThumb"`
|
PreviewURLThumb string `json:"previewURLThumb"`
|
||||||
IconURL string `json:"iconURL"`
|
IconURL string `json:"iconURL"`
|
||||||
|
|
||||||
README string `json:"readme"`
|
|
||||||
|
|
||||||
Installed bool `json:"installed"`
|
Installed bool `json:"installed"`
|
||||||
Outdated bool `json:"outdated"`
|
Outdated bool `json:"outdated"`
|
||||||
Current bool `json:"current"`
|
Current bool `json:"current"`
|
||||||
|
|
|
||||||
|
|
@ -148,12 +148,14 @@ func InstalledPlugins() (ret []*Plugin) {
|
||||||
installSize, _ := util.SizeOfDirectory(installPath)
|
installSize, _ := util.SizeOfDirectory(installPath)
|
||||||
plugin.InstallSize = installSize
|
plugin.InstallSize = installSize
|
||||||
plugin.HInstallSize = humanize.Bytes(uint64(installSize))
|
plugin.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||||
readme, readErr := os.ReadFile(filepath.Join(installPath, "README.md"))
|
readmeFilename := getPreferredReadme(plugin.Readme)
|
||||||
|
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||||
if nil != readErr {
|
if nil != readErr {
|
||||||
logging.LogWarnf("read install plugin README.md failed: %s", readErr)
|
logging.LogWarnf("read installed README.md failed: %s", readErr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
plugin.README, _ = renderREADME(plugin.URL, readme)
|
|
||||||
|
plugin.PreferredReadme, _ = renderREADME(plugin.URL, readme)
|
||||||
plugin.Outdated = isOutdatedPlugin(plugin, bazaarPlugins)
|
plugin.Outdated = isOutdatedPlugin(plugin, bazaarPlugins)
|
||||||
ret = append(ret, plugin)
|
ret = append(ret, plugin)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,12 +149,14 @@ func InstalledTemplates() (ret []*Template) {
|
||||||
installSize, _ := util.SizeOfDirectory(installPath)
|
installSize, _ := util.SizeOfDirectory(installPath)
|
||||||
template.InstallSize = installSize
|
template.InstallSize = installSize
|
||||||
template.HInstallSize = humanize.Bytes(uint64(installSize))
|
template.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||||
readme, readErr := os.ReadFile(filepath.Join(installPath, "README.md"))
|
readmeFilename := getPreferredReadme(template.Readme)
|
||||||
|
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||||
if nil != readErr {
|
if nil != readErr {
|
||||||
logging.LogWarnf("read install template README.md failed: %s", readErr)
|
logging.LogWarnf("read installed README.md failed: %s", readErr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
template.README, _ = renderREADME(template.URL, readme)
|
|
||||||
|
template.PreferredReadme, _ = renderREADME(template.URL, readme)
|
||||||
template.Outdated = isOutdatedTemplate(template, bazaarTemplates)
|
template.Outdated = isOutdatedTemplate(template, bazaarTemplates)
|
||||||
ret = append(ret, template)
|
ret = append(ret, template)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -150,12 +150,14 @@ func InstalledThemes() (ret []*Theme) {
|
||||||
installSize, _ := util.SizeOfDirectory(installPath)
|
installSize, _ := util.SizeOfDirectory(installPath)
|
||||||
theme.InstallSize = installSize
|
theme.InstallSize = installSize
|
||||||
theme.HInstallSize = humanize.Bytes(uint64(installSize))
|
theme.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||||
readme, readErr := os.ReadFile(filepath.Join(installPath, "README.md"))
|
readmeFilename := getPreferredReadme(theme.Readme)
|
||||||
|
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||||
if nil != readErr {
|
if nil != readErr {
|
||||||
logging.LogWarnf("read install theme README.md failed: %s", readErr)
|
logging.LogWarnf("read installed README.md failed: %s", readErr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
theme.README, _ = renderREADME(theme.URL, readme)
|
|
||||||
|
theme.PreferredReadme, _ = renderREADME(theme.URL, readme)
|
||||||
theme.Outdated = isOutdatedTheme(theme, bazaarThemes)
|
theme.Outdated = isOutdatedTheme(theme, bazaarThemes)
|
||||||
ret = append(ret, theme)
|
ret = append(ret, theme)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,12 +147,14 @@ func InstalledWidgets() (ret []*Widget) {
|
||||||
installSize, _ := util.SizeOfDirectory(installPath)
|
installSize, _ := util.SizeOfDirectory(installPath)
|
||||||
widget.InstallSize = installSize
|
widget.InstallSize = installSize
|
||||||
widget.HInstallSize = humanize.Bytes(uint64(installSize))
|
widget.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||||
readme, readErr := os.ReadFile(filepath.Join(installPath, "README.md"))
|
readmeFilename := getPreferredReadme(widget.Readme)
|
||||||
|
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||||
if nil != readErr {
|
if nil != readErr {
|
||||||
logging.LogWarnf("read install widget README.md failed: %s", readErr)
|
logging.LogWarnf("read installed README.md failed: %s", readErr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
widget.README, _ = renderREADME(widget.URL, readme)
|
|
||||||
|
widget.PreferredReadme, _ = renderREADME(widget.URL, readme)
|
||||||
widget.Outdated = isOutdatedWidget(widget, bazaarWidgets)
|
widget.Outdated = isOutdatedWidget(widget, bazaarWidgets)
|
||||||
ret = append(ret, widget)
|
ret = append(ret, widget)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue