feat: add bilingual support to info modal

- Added 'ui' section to cv-en.json and cv-es.json with modal translations
- Updated Go models to include UI, InfoModal, and TechStack structs
- Modified template to use JSON data instead of inline if/else statements
- Used template.HTML for Description field to allow HTML rendering
- Modal now fully supports English and Spanish translations

Translations include:
- Modal title
- Description text
- Tech stack labels (HTML5 Semántico vs Semantic HTML5, etc.)
- View source button text
This commit is contained in:
juanatsap
2025-11-09 20:59:10 +00:00
parent 1fc30f6525
commit de0c443764
4 changed files with 53 additions and 11 deletions
+20
View File
@@ -3,6 +3,7 @@ package models
import (
"encoding/json"
"fmt"
"html/template"
"os"
)
@@ -21,6 +22,7 @@ type CV struct {
Courses []Course `json:"courses"`
References []Reference `json:"references"`
Other Other `json:"other"`
UI UI `json:"ui"`
Meta Meta `json:"meta"`
}
@@ -168,6 +170,24 @@ type Meta struct {
Language string `json:"language"`
}
type UI struct {
InfoModal InfoModal `json:"infoModal"`
}
type InfoModal struct {
Title string `json:"title"`
Description template.HTML `json:"description"`
TechStack TechStack `json:"techStack"`
ViewSource string `json:"viewSource"`
}
type TechStack struct {
GoHono string `json:"goHono"`
HTMX string `json:"htmx"`
HTML5 string `json:"html5"`
CSS3 string `json:"css3"`
}
// LoadCV loads CV data from a JSON file for the specified language
func LoadCV(lang string) (*CV, error) {
// Validate language