Add i18n data structures for cookie banner

Add cookie_banner_translations table to store per-language
translations as JSONB, and a default_language column on
cookie_banners. Extend the version snapshot types to carry
translated UI strings and category content per language.

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-22 19:05:41 +04:00
parent 4678c58ab0
commit d189913ba3
5 changed files with 370 additions and 4 deletions

View File

@@ -39,6 +39,7 @@ type (
ConsentExpiryDays int `db:"consent_expiry_days"`
ConsentMode CookieConsentMode `db:"consent_mode"`
ShowBranding bool `db:"show_branding"`
DefaultLanguage string `db:"default_language"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
@@ -87,6 +88,7 @@ SELECT
consent_expiry_days,
consent_mode,
show_branding,
default_language,
created_at,
updated_at
FROM
@@ -137,6 +139,7 @@ SELECT
consent_expiry_days,
consent_mode,
show_branding,
default_language,
created_at,
updated_at
FROM
@@ -188,6 +191,7 @@ SELECT
consent_expiry_days,
consent_mode,
show_branding,
default_language,
created_at,
updated_at
FROM
@@ -245,6 +249,7 @@ SELECT
consent_expiry_days,
consent_mode,
show_branding,
default_language,
created_at,
updated_at
FROM
@@ -329,6 +334,7 @@ INSERT INTO cookie_banners (
consent_expiry_days,
consent_mode,
show_branding,
default_language,
created_at,
updated_at
) VALUES (
@@ -342,6 +348,7 @@ INSERT INTO cookie_banners (
@consent_expiry_days,
@consent_mode,
@show_branding,
@default_language,
@created_at,
@updated_at
)
@@ -358,6 +365,7 @@ INSERT INTO cookie_banners (
"consent_expiry_days": b.ConsentExpiryDays,
"consent_mode": b.ConsentMode,
"show_branding": b.ShowBranding,
"default_language": b.DefaultLanguage,
"created_at": b.CreatedAt,
"updated_at": b.UpdatedAt,
}
@@ -390,6 +398,7 @@ SET
consent_expiry_days = @consent_expiry_days,
consent_mode = @consent_mode,
show_branding = @show_branding,
default_language = @default_language,
updated_at = @updated_at
WHERE
%s
@@ -407,6 +416,7 @@ WHERE
"consent_expiry_days": b.ConsentExpiryDays,
"consent_mode": b.ConsentMode,
"show_branding": b.ShowBranding,
"default_language": b.DefaultLanguage,
"updated_at": b.UpdatedAt,
}
maps.Copy(args, scope.SQLArguments())