diff --git a/gui/default/assets/lang/lang-en.json b/gui/default/assets/lang/lang-en.json index d7c2585a0..314cf7939 100644 --- a/gui/default/assets/lang/lang-en.json +++ b/gui/default/assets/lang/lang-en.json @@ -94,6 +94,7 @@ "Discovered": "Discovered", "Discovery": "Discovery", "Discovery Failures": "Discovery Failures", + "Discovery Status": "Discovery Status", "Dismiss": "Dismiss", "Do not add it to the ignore list, so this notification may recur.": "Do not add it to the ignore list, so this notification may recur.", "Do not restore": "Do not restore", @@ -121,6 +122,7 @@ "Error": "Error", "External File Versioning": "External File Versioning", "Failed Items": "Failed Items", + "Failed to load ignore patterns.": "Failed to load ignore patterns.", "Failed to setup, retrying": "Failed to setup, retrying", "Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.", "File Pull Order": "File Pull Order", @@ -178,6 +180,8 @@ "Latest Change": "Latest Change", "Learn more": "Learn more", "Limit": "Limit", + "Listener Failures": "Listener Failures", + "Listener Status": "Listener Status", "Listeners": "Listeners", "Loading data...": "Loading data...", "Loading...": "Loading...", @@ -216,6 +220,7 @@ "Out of Sync": "Out of Sync", "Out of Sync Items": "Out of Sync Items", "Outgoing Rate Limit (KiB/s)": "Outgoing Rate Limit (KiB/s)", + "Override": "Override", "Override Changes": "Override Changes", "Path": "Path", "Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for": "Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for", @@ -265,6 +270,7 @@ "Resume": "Resume", "Resume All": "Resume All", "Reused": "Reused", + "Revert": "Revert", "Revert Local Changes": "Revert Local Changes", "Save": "Save", "Scan Time Remaining": "Scan Time Remaining", diff --git a/script/translate.go b/script/translate.go index 928068b5d..12a7def82 100644 --- a/script/translate.go +++ b/script/translate.go @@ -9,6 +9,7 @@ package main import ( + "bufio" "encoding/json" "log" "os" @@ -22,6 +23,7 @@ import ( var trans = make(map[string]string) var attrRe = regexp.MustCompile(`\{\{\s*'([^']+)'\s+\|\s+translate\s*\}\}`) var attrReCond = regexp.MustCompile(`\{\{.+\s+\?\s+'([^']+)'\s+:\s+'([^']+)'\s+\|\s+translate\s*\}\}`) +var jsRe = regexp.MustCompile(`\$translate.instant\("([^"]+)"\)`) // exceptions to the untranslated text warning var noStringRe = regexp.MustCompile( @@ -108,17 +110,27 @@ func walkerFor(basePath string) filepath.WalkFunc { return err } - if filepath.Ext(name) == ".html" && info.Mode().IsRegular() { - fd, err := os.Open(name) - if err != nil { - log.Fatal(err) - } + if !info.Mode().IsRegular() { + return nil + } + fd, err := os.Open(name) + if err != nil { + log.Fatal(err) + } + defer fd.Close() + switch filepath.Ext(name) { + case ".html": doc, err := html.Parse(fd) if err != nil { log.Fatal(err) } - fd.Close() generalNode(doc, filepath.Base(name)) + case ".js": + for s := bufio.NewScanner(fd); s.Scan(); { + for _, matches := range jsRe.FindAllStringSubmatch(s.Text(), -1) { + translation(matches[1]) + } + } } return nil