From ae743ba8a6e68622ddd7aa5bf0e01da95153a5b0 Mon Sep 17 00:00:00 2001
From: landaiqing <3517283258@qq.com>
Date: Tue, 12 Nov 2024 22:59:39 +0800
Subject: [PATCH] :sparkles: add i18n support
---
.gitignore | 1 +
.idea/GOHCache.xml | 547 +++---
app/auth/auth.api | 2 +-
app/auth/auth.go | 12 +-
app/auth/etc/auth.yaml | 5 +-
app/auth/internal/config/config.go | 6 +-
app/auth/internal/handler/routes.go | 2 +-
.../logic/user/account_login_logic.go | 7 +-
.../internal/middleware/i18n_middleware.go | 19 -
app/auth/internal/svc/service_context.go | 6 +-
common/core/mysql.go | 9 +-
common/ent/entql.go | 756 ++++++++
common/ent/generate.go | 2 +-
common/ent/migrate/schema.go | 243 +--
common/ent/mutation.go | 1650 +++++++++--------
common/ent/privacy/privacy.go | 299 +++
common/ent/runtime.go | 152 +-
common/ent/scaauthpermissionrule.go | 2 +-
.../scaauthpermissionrule.go | 8 +-
common/ent/scaauthrole.go | 70 +-
common/ent/scaauthrole/scaauthrole.go | 72 +-
common/ent/scaauthrole/where.go | 264 +--
common/ent/scaauthrole_create.go | 90 +-
common/ent/scaauthrole_query.go | 8 +-
common/ent/scaauthrole_update.go | 184 +-
common/ent/scaauthuser.go | 75 +-
common/ent/scaauthuser/scaauthuser.go | 76 +-
common/ent/scaauthuser/where.go | 290 +--
common/ent/scaauthuser_create.go | 139 +-
common/ent/scaauthuser_query.go | 8 +-
common/ent/scaauthuser_update.go | 202 +-
common/ent/scaauthuserdevice.go | 73 +-
.../scaauthuserdevice/scaauthuserdevice.go | 74 +-
common/ent/scaauthuserdevice/where.go | 290 +--
common/ent/scaauthuserdevice_create.go | 131 +-
common/ent/scaauthuserdevice_query.go | 8 +-
common/ent/scaauthuserdevice_update.go | 190 +-
common/ent/scaauthusersocial.go | 75 +-
.../scaauthusersocial/scaauthusersocial.go | 74 +-
common/ent/scaauthusersocial/where.go | 274 +--
common/ent/scaauthusersocial_create.go | 139 +-
common/ent/scaauthusersocial_query.go | 8 +-
common/ent/scaauthusersocial_update.go | 202 +-
common/ent/schema/mixin/default_mixin.go | 31 +
common/ent/schema/sca_auth_permission_rule.go | 17 +-
common/ent/schema/sca_auth_role.go | 38 +-
common/ent/schema/sca_auth_user.go | 40 +-
common/ent/schema/sca_auth_user_device.go | 39 +-
common/ent/schema/sca_auth_user_social.go | 45 +-
common/i18n/bundle.go | 16 +
common/i18n/cache.go | 62 +
common/i18n/i18n.go | 61 +
common/i18n/keys.go | 21 +
common/i18n/middleware.go | 28 +
common/i18n/parse.go | 14 +
common/i18n/rpc_interceptor.go | 74 +
common/middleware/cors_middleware.go | 12 +
common/middleware/i18n_middleware.go | 13 +-
go.mod | 2 +
go.sum | 4 +
resources/language/active.en.toml | 2 +
resources/language/active.zh.toml | 2 +
62 files changed, 4468 insertions(+), 2797 deletions(-)
delete mode 100644 app/auth/internal/middleware/i18n_middleware.go
create mode 100644 common/ent/entql.go
create mode 100644 common/ent/privacy/privacy.go
create mode 100644 common/ent/schema/mixin/default_mixin.go
create mode 100644 common/i18n/bundle.go
create mode 100644 common/i18n/cache.go
create mode 100644 common/i18n/i18n.go
create mode 100644 common/i18n/keys.go
create mode 100644 common/i18n/middleware.go
create mode 100644 common/i18n/parse.go
create mode 100644 common/i18n/rpc_interceptor.go
create mode 100644 common/middleware/cors_middleware.go
create mode 100644 resources/language/active.en.toml
create mode 100644 resources/language/active.zh.toml
diff --git a/.gitignore b/.gitignore
index 8273639..3233824 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+out/
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
diff --git a/.idea/GOHCache.xml b/.idea/GOHCache.xml
index 76fffff..1f28251 100644
--- a/.idea/GOHCache.xml
+++ b/.idea/GOHCache.xml
@@ -20,14 +20,14 @@
-
+
-
+
@@ -41,7 +41,21 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -49,6 +63,7 @@
+
@@ -62,21 +77,21 @@
-
+
-
+
-
+
@@ -111,7 +126,7 @@
-
+
@@ -119,84 +134,91 @@
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -204,129 +226,134 @@
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
+
-
+
-
+
-
+
-
+
-
+
@@ -334,233 +361,232 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -581,70 +607,70 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -655,14 +681,14 @@
-
+
-
+