[add] migrate fs & i18n

This commit is contained in:
Max 2023-02-02 11:29:58 +08:00
parent bee77eca24
commit a9f304060b
3 changed files with 6 additions and 6 deletions

View file

@ -9,7 +9,7 @@ COMMIT := $(shell git log | head -n 1 | awk '{print substr($$2, 0, 12)}')
NOW := $(shell date +"%FT%T%z") NOW := $(shell date +"%FT%T%z")
# ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) # ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
TESTFOLDER := $(shell $(GO) list ./... | grep -E 'api|model|flow|script' | grep -vE 'examples|tests*|config|widgets') TESTFOLDER := $(shell $(GO) list ./... | grep -E 'api|model|flow|script|fs|i18n' | grep -vE 'examples|tests*|config|widgets')
TESTTAGS ?= "" TESTTAGS ?= ""
# TESTWIDGETS := $(shell $(GO) list ./widgets/...) # TESTWIDGETS := $(shell $(GO) list ./widgets/...)

View file

@ -3,7 +3,6 @@ package i18n
import ( import (
"crypto/sha256" "crypto/sha256"
"fmt" "fmt"
"path/filepath"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -45,8 +44,7 @@ func Load(cfg config.Config) error {
} }
// Load langs // Load langs
root := filepath.Join(cfg.Root, "langs") err = lang.Load("langs")
err = lang.Load(root)
if err != nil { if err != nil {
return err return err
} }

View file

@ -6,11 +6,13 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/yaoapp/gou/lang" "github.com/yaoapp/gou/lang"
"github.com/yaoapp/yao/config" "github.com/yaoapp/yao/config"
"github.com/yaoapp/yao/share" "github.com/yaoapp/yao/test"
) )
func TestLoad(t *testing.T) { func TestLoad(t *testing.T) {
share.DBConnect(config.Conf.DB) test.Prepare(t, config.Conf)
defer test.Clean()
err := Load(config.Conf) err := Load(config.Conf)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)