Fix widget i18n missing locale files and clean up unused locales

- widget/i18n/index.js: only import en.json and zh_CN.json (the only
  locale files present); remove 40+ imports for missing locale JSONs
  that caused Vite compile failure and global white screen
- dashboard/i18n/index.js: remove unused locale imports for consistency
- Remove 62 unused locale JSON files from widget/i18n/locale/
- Minor: update index.html, test helpers, e2e test, languages spec
This commit is contained in:
2026-07-08 09:57:00 +08:00
parent 9c74b83560
commit a1ae852eb2
67 changed files with 1019 additions and 8425 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ func seedSmokeData(ctx context.Context, db *gorm.DB) (*smokeSeedSummary, error)
account := &model.Account{}
smokeFeatureFlags := `{"advanced_assignment":true,"assignment_v2":true,"audit_logs":true,"automations":true,"captain_integration":true,"captain_integration_v2":true,"captain_tasks":true,"companies":true,"crm":true,"csat":true,"custom_roles":true,"custom_tools":true,"inbox_management":true,"macros":true,"reports":true,"sla":true}`
if err := db.WithContext(ctx).Where("name = ?", accountName).FirstOrCreate(account, model.Account{Name: accountName, Locale: "en", Timezone: "UTC", Active: true, Status: "active", FeatureFlags: smokeFeatureFlags}).Error; err != nil {
if err := db.WithContext(ctx).Where("name = ?", accountName).FirstOrCreate(account, model.Account{Name: accountName, Locale: "zh_CN", Timezone: "UTC", Active: true, Status: "active", FeatureFlags: smokeFeatureFlags}).Error; err != nil {
return nil, fmt.Errorf("seed account: %w", err)
}
if err := db.WithContext(ctx).Model(account).Updates(map[string]any{"active": true, "status": "active", "feature_flags": smokeFeatureFlags}).Error; err != nil {
+1 -1
View File
@@ -11,7 +11,7 @@ type Account struct {
Base
Name string `gorm:"size:255;not null" json:"name"`
Domain string `gorm:"size:255" json:"domain,omitempty"`
Locale string `gorm:"size:10;default:en" json:"locale"`
Locale string `gorm:"size:10;default:zh_CN" json:"locale"`
Timezone string `gorm:"size:50;default:UTC" json:"timezone"`
ReportingTimezone string `gorm:"size:100" json:"reporting_timezone,omitempty"`
Active bool `gorm:"default:true" json:"active"`
+1 -1
View File
@@ -17,7 +17,7 @@ import (
func NewAccountFixture(name string) *model.Account {
return &model.Account{
Name: name,
Locale: "en",
Locale: "zh_CN",
Timezone: "UTC",
Active: true,
}
+1 -1
View File
@@ -166,7 +166,7 @@ func AssertTimestampOrder(t *testing.T, createdAt, updatedAt time.Time) {
// SeedAccount creates and persists a test account.
func SeedAccount(t *testing.T, db *gorm.DB, name string) *model.Account {
t.Helper()
acc := &model.Account{Name: name, Locale: "en", Timezone: "UTC", Active: true}
acc := &model.Account{Name: name, Locale: "zh_CN", Timezone: "UTC", Active: true}
err := db.Create(acc).Error
assert.NoError(t, err, "failed to seed account")
return acc
+1 -1
View File
@@ -242,7 +242,7 @@ func (s *E2ETestSuite) Router() *gin.Engine {
func (s *E2ETestSuite) CreateTestAccount(name string) *model.Account {
account := &model.Account{
Name: name,
Locale: "en",
Locale: "zh_CN",
Timezone: "UTC",
Active: true,
}