summaryrefslogtreecommitdiffstats
path: root/colorschemes/registry.go
diff options
context:
space:
mode:
Diffstat (limited to 'colorschemes/registry.go')
-rw-r--r--colorschemes/registry.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/colorschemes/registry.go b/colorschemes/registry.go
index baa4bda..84b2e89 100644
--- a/colorschemes/registry.go
+++ b/colorschemes/registry.go
@@ -6,6 +6,7 @@ import (
"path/filepath"
"strings"
+ "github.com/jdkeke142/lingo-toml"
"github.com/shibukawa/configdir"
)
@@ -17,6 +18,13 @@ func init() {
}
}
+var tr lingo.Translations
+
+// Set the translation library
+func SetTr(tra lingo.Translations) {
+ tr = tra
+}
+
// FromName loads a Colorscheme by name; confDir is used to search
// directories for a scheme matching the name. The search order
// is the same as for config files.
@@ -46,15 +54,15 @@ func getCustomColorscheme(confDir configdir.ConfigDir, name string) (Colorscheme
for _, d := range confDir.QueryFolders(configdir.Existing) {
paths = append(paths, d.Path)
}
- return cs, fmt.Errorf("failed to find colorscheme file %s in %s", fn, strings.Join(paths, ", "))
+ return cs, fmt.Errorf(tr.Value("error.colorschemefile", fn, strings.Join(paths, ", ")))
}
dat, err := folder.ReadFile(fn)
if err != nil {
- return cs, fmt.Errorf("failed to read colorscheme file %s: %v", filepath.Join(folder.Path, fn), err)
+ return cs, fmt.Errorf(tr.Value("error.colorschemeload", filepath.Join(folder.Path, fn), err.Error()))
}
err = json.Unmarshal(dat, &cs)
if err != nil {
- return cs, fmt.Errorf("failed to parse colorscheme file: %v", err)
+ return cs, fmt.Errorf(tr.Value("error.colorschemeparse", err.Error()))
}
return cs, nil
}