🎨 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>`;
|
||||
if (dataObj.downloaded) {
|
||||
const mdElement = readmeElement.querySelector(".item__readme");
|
||||
mdElement.innerHTML = data.readme;
|
||||
mdElement.innerHTML = data.preferredReadme;
|
||||
highlightRender(mdElement);
|
||||
} else {
|
||||
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
|
||||
preferredName: string
|
||||
preferredDesc: string
|
||||
preferredReadme: string
|
||||
iconURL: string
|
||||
readme: string
|
||||
stars: string
|
||||
author: string
|
||||
updated: string
|
||||
|
|
|
@ -142,13 +142,14 @@ func InstalledIcons() (ret []*Icon) {
|
|||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
icon.InstallSize = 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 {
|
||||
logging.LogWarnf("read install icon README.md failed: %s", readErr)
|
||||
logging.LogWarnf("read installed README.md failed: %s", readErr)
|
||||
continue
|
||||
}
|
||||
|
||||
icon.README, _ = renderREADME(icon.URL, readme)
|
||||
icon.PreferredReadme, _ = renderREADME(icon.URL, readme)
|
||||
icon.Outdated = isOutdatedIcon(icon, bazaarIcons)
|
||||
ret = append(ret, icon)
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ type Package struct {
|
|||
PreferredFunding string `json:"preferredFunding"`
|
||||
PreferredName string `json:"preferredName"`
|
||||
PreferredDesc string `json:"preferredDesc"`
|
||||
PreferredReadme string `json:"preferredReadme"`
|
||||
|
||||
Name string `json:"name"`
|
||||
RepoURL string `json:"repoURL"`
|
||||
|
@ -84,8 +85,6 @@ type Package struct {
|
|||
PreviewURLThumb string `json:"previewURLThumb"`
|
||||
IconURL string `json:"iconURL"`
|
||||
|
||||
README string `json:"readme"`
|
||||
|
||||
Installed bool `json:"installed"`
|
||||
Outdated bool `json:"outdated"`
|
||||
Current bool `json:"current"`
|
||||
|
|
|
@ -148,12 +148,14 @@ func InstalledPlugins() (ret []*Plugin) {
|
|||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
plugin.InstallSize = 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 {
|
||||
logging.LogWarnf("read install plugin README.md failed: %s", readErr)
|
||||
logging.LogWarnf("read installed README.md failed: %s", readErr)
|
||||
continue
|
||||
}
|
||||
plugin.README, _ = renderREADME(plugin.URL, readme)
|
||||
|
||||
plugin.PreferredReadme, _ = renderREADME(plugin.URL, readme)
|
||||
plugin.Outdated = isOutdatedPlugin(plugin, bazaarPlugins)
|
||||
ret = append(ret, plugin)
|
||||
}
|
||||
|
|
|
@ -149,12 +149,14 @@ func InstalledTemplates() (ret []*Template) {
|
|||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
template.InstallSize = 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 {
|
||||
logging.LogWarnf("read install template README.md failed: %s", readErr)
|
||||
logging.LogWarnf("read installed README.md failed: %s", readErr)
|
||||
continue
|
||||
}
|
||||
template.README, _ = renderREADME(template.URL, readme)
|
||||
|
||||
template.PreferredReadme, _ = renderREADME(template.URL, readme)
|
||||
template.Outdated = isOutdatedTemplate(template, bazaarTemplates)
|
||||
ret = append(ret, template)
|
||||
}
|
||||
|
|
|
@ -150,12 +150,14 @@ func InstalledThemes() (ret []*Theme) {
|
|||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
theme.InstallSize = 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 {
|
||||
logging.LogWarnf("read install theme README.md failed: %s", readErr)
|
||||
logging.LogWarnf("read installed README.md failed: %s", readErr)
|
||||
continue
|
||||
}
|
||||
theme.README, _ = renderREADME(theme.URL, readme)
|
||||
|
||||
theme.PreferredReadme, _ = renderREADME(theme.URL, readme)
|
||||
theme.Outdated = isOutdatedTheme(theme, bazaarThemes)
|
||||
ret = append(ret, theme)
|
||||
}
|
||||
|
|
|
@ -147,12 +147,14 @@ func InstalledWidgets() (ret []*Widget) {
|
|||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
widget.InstallSize = 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 {
|
||||
logging.LogWarnf("read install widget README.md failed: %s", readErr)
|
||||
logging.LogWarnf("read installed README.md failed: %s", readErr)
|
||||
continue
|
||||
}
|
||||
widget.README, _ = renderREADME(widget.URL, readme)
|
||||
|
||||
widget.PreferredReadme, _ = renderREADME(widget.URL, readme)
|
||||
widget.Outdated = isOutdatedWidget(widget, bazaarWidgets)
|
||||
ret = append(ret, widget)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue