Fix: locale and theme complite percent
ci/woodpecker/push/test_golang Pipeline was successful Details

main
Leonid Maslakov 4 months ago
parent a614bede39
commit 5a29c80d76

@ -23,8 +23,8 @@ import (
"git.lcomrade.su/root/lenpaste/internal/netshare"
"net/http"
"os"
"strconv"
"runtime"
"strconv"
"time"
)

@ -137,7 +137,10 @@ func loadThemes(hostThemeDir string, localesList LocalesList, defaultTheme *stri
}
// Add theme to themes list
themeNameSuffix := fmt.Sprintf(" (%.2f%%)", (float32(curTotal)/float32(defTotal))*100)
themeNameSuffix := ""
if curTotal != defTotal {
themeNameSuffix = fmt.Sprintf(" (%.2f%%)", (float32(curTotal)/float32(defTotal))*100)
}
themesList[baseLocale][key] = themeName + themeNameSuffix
for localeCode, _ := range localesList {

@ -100,7 +100,11 @@ func loadLocales(f embed.FS, localeDir string) (Locales, LocalesList, error) {
return nil, nil, errors.New("web: locale '" + key + "' is empty")
}
localesList[key] = localeName + fmt.Sprintf(" (%.2f%%)", (float32(curTotal)/float32(defTotal))*100)
if curTotal == defTotal {
localesList[key] = localeName
} else {
localesList[key] = localeName + fmt.Sprintf(" (%.2f%%)", (float32(curTotal)/float32(defTotal))*100)
}
}
return locales, localesList, nil

Loading…
Cancel
Save