Fix loading overridden translations from ${DataFolder}/resources/i18n
This commit is contained in:
@@ -28,7 +28,7 @@ var (
|
||||
)
|
||||
|
||||
func newTranslationRepository(context.Context) rest.Repository {
|
||||
if err := loadTranslations(resources.FS); err != nil {
|
||||
if err := loadTranslations(resources.FS()); err != nil {
|
||||
log.Error("Error loading translation files", err)
|
||||
}
|
||||
return &translationRepository{}
|
||||
|
||||
@@ -3,7 +3,7 @@ package nativeapi
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -15,17 +15,14 @@ import (
|
||||
|
||||
var _ = Describe("Translations", func() {
|
||||
Describe("I18n files", func() {
|
||||
var fs http.FileSystem
|
||||
BeforeEach(func() {
|
||||
fs = http.FS(resources.FS)
|
||||
})
|
||||
It("contains only valid json language files", func() {
|
||||
dir, _ := fs.Open(consts.I18nFolder)
|
||||
files, _ := dir.Readdir(0)
|
||||
fsys := resources.FS()
|
||||
dir, _ := fsys.Open(consts.I18nFolder)
|
||||
files, _ := dir.(fs.ReadDirFile).ReadDir(-1)
|
||||
for _, f := range files {
|
||||
name := filepath.Base(f.Name())
|
||||
filePath := filepath.Join(consts.I18nFolder, name)
|
||||
file, _ := fs.Open(filePath)
|
||||
file, _ := fsys.Open(filePath)
|
||||
data, _ := io.ReadAll(file)
|
||||
var out map[string]interface{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user