WIP: feat: translation support
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
See #483
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@ -9,6 +9,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"coopcloud.tech/abra/pkg/i18n"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
)
|
||||
|
||||
@ -33,7 +34,7 @@ func GetServers() ([]string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("retrieved %v servers: %s", len(filtered), filtered)
|
||||
log.Debug(i18n.G("retrieved %v servers: %s", len(filtered), filtered))
|
||||
|
||||
return filtered, nil
|
||||
}
|
||||
@ -46,7 +47,7 @@ func ReadServerNames() ([]string, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Debugf("read %s from %s", strings.Join(serverNames, ","), SERVERS_DIR)
|
||||
log.Debug(i18n.G("read %s from %s", strings.Join(serverNames, ","), SERVERS_DIR))
|
||||
|
||||
return serverNames, nil
|
||||
}
|
||||
@ -70,7 +71,7 @@ func GetAllFilesInDirectory(directory string) ([]fs.FileInfo, error) {
|
||||
|
||||
realPath, err := filepath.EvalSymlinks(filePath)
|
||||
if err != nil {
|
||||
log.Warnf("broken symlink in your abra config folders: %s", filePath)
|
||||
log.Warn(i18n.G("broken symlink in your abra config folders: %s", filePath))
|
||||
} else {
|
||||
realFile, err := os.Stat(realPath)
|
||||
if err != nil {
|
||||
@ -94,7 +95,7 @@ func GetAllFoldersInDirectory(directory string) ([]string, error) {
|
||||
return nil, err
|
||||
}
|
||||
if len(files) == 0 {
|
||||
return nil, fmt.Errorf("directory is empty: %s", directory)
|
||||
return nil, errors.New(i18n.G("directory is empty: %s", directory))
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
@ -103,7 +104,7 @@ func GetAllFoldersInDirectory(directory string) ([]string, error) {
|
||||
filePath := path.Join(directory, file.Name())
|
||||
realDir, err := filepath.EvalSymlinks(filePath)
|
||||
if err != nil {
|
||||
log.Warnf("broken symlink in your abra config folders: %s", filePath)
|
||||
log.Warn(i18n.G("broken symlink in your abra config folders: %s", filePath))
|
||||
} else if stat, err := os.Stat(realDir); err == nil && stat.IsDir() {
|
||||
// path is a directory
|
||||
folders = append(folders, file.Name())
|
||||
|
Reference in New Issue
Block a user