diff options
author | Sean E. Russell <ser@ser1.net> | 2020-06-20 16:47:48 -0500 |
---|---|---|
committer | Sean E. Russell <ser@ser1.net> | 2020-06-20 16:47:48 -0500 |
commit | 23364aa754c836b8a5fbc69adbdbd49abd183a57 (patch) | |
tree | 51f9137e2bd2090ffdd938fd7c1a7b4b71c56402 /colorschemes | |
parent | 9a56571373eb5a9ea9261afb39bebaf7ddeb700f (diff) |
More strings moved to translations
Diffstat (limited to 'colorschemes')
-rw-r--r-- | colorschemes/registry.go | 14 |
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 } |