Added basic i18n

This commit is contained in:
2026-03-10 15:18:34 +08:00
parent 093a8745ac
commit 7d1de5f781
25 changed files with 660 additions and 105 deletions

31
i18n/race_test.go Normal file
View File

@@ -0,0 +1,31 @@
package i18n
import (
"sync"
"testing"
)
func TestLoadKeysRace(t *testing.T) {
// Reset shared global state so the test starts clean
LangPacks = map[string]LangPack{}
const goroutines = 200
var wg sync.WaitGroup
wg.Add(goroutines)
start := make(chan struct{})
for i := 0; i < goroutines; i++ {
go func() {
defer wg.Done()
<-start
_, _ = LoadKeys("en")
}()
}
// Release all goroutines at once to maximize overlap
close(start)
wg.Wait()
}