build: correct API call for Weblate statistics
Something changed...
This commit is contained in:
+6
-6
@@ -45,11 +45,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
log.Println(curValidLangs)
|
log.Println(curValidLangs)
|
||||||
|
|
||||||
resp := req("https://hosted.weblate.org/exports/stats/syncthing/gui/?format=json", token)
|
resp := req("https://hosted.weblate.org/api/components/syncthing/gui/statistics/", token)
|
||||||
|
var statRes struct {
|
||||||
var stats []stat
|
Results []stat
|
||||||
err := json.NewDecoder(resp.Body).Decode(&stats)
|
}
|
||||||
if err != nil {
|
if err := json.NewDecoder(resp.Body).Decode(&statRes); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
@@ -57,7 +57,7 @@ func main() {
|
|||||||
names := make(map[string]string)
|
names := make(map[string]string)
|
||||||
|
|
||||||
var langs []string
|
var langs []string
|
||||||
for _, stat := range stats {
|
for _, stat := range statRes.Results {
|
||||||
code := reformatLanguageCode(stat.Code)
|
code := reformatLanguageCode(stat.Code)
|
||||||
pct := 100 * stat.Translated / stat.Total
|
pct := 100 * stat.Translated / stat.Total
|
||||||
if _, valid := curValidLangs[code]; pct < 75 || !valid && pct < 95 {
|
if _, valid := curValidLangs[code]; pct < 75 || !valid && pct < 95 {
|
||||||
|
|||||||
Reference in New Issue
Block a user