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
+13
View File
@@ -911,6 +911,19 @@
"other": {
"driverLicense": "<strong>Type B</strong>"
},
"ui": {
"infoModal": {
"title": "About this CV",
"description": "This interactive CV was built by myself with <strong>Go + HTMX</strong>, showcasing modern hypermedia architecture without heavy JavaScript frameworks.",
"techStack": {
"goHono": "Go + Hono",
"htmx": "HTMX",
"html5": "Semantic HTML5",
"css3": "Pure CSS3"
},
"viewSource": "View Source Code"
}
},
"meta": {
"version": "2025-11-09",
"lastUpdated": "2025-11-08",
+13
View File
@@ -916,6 +916,19 @@
"other": {
"driverLicense": "<strong>Tipo B</strong>"
},
"ui": {
"infoModal": {
"title": "Acerca de este CV",
"description": "Este CV interactivo fue construido por mí mismo con <strong>Go + HTMX</strong>, demostrando arquitectura moderna de hipermedia sin frameworks pesados de JavaScript.",
"techStack": {
"goHono": "Go + Hono",
"htmx": "HTMX",
"html5": "HTML5 Semántico",
"css3": "CSS3 Puro"
},
"viewSource": "Ver código fuente"
}
},
"meta": {
"version": "2025-11-09",
"lastUpdated": "2025-11-08",
+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
+7 -11
View File
@@ -297,41 +297,37 @@
</button>
<div class="info-modal-header">
<h2>{{if eq .Lang "es"}}Acerca de este CV{{else}}About this CV{{end}}</h2>
<h2>{{.CV.UI.InfoModal.Title}}</h2>
<div class="info-modal-cv-title">CV {{.CurrentYear}} - {JAMR}</div>
</div>
<div class="info-modal-body">
<p class="info-modal-description">
{{if eq .Lang "es"}}
Este CV interactivo fue construido por mí mismo con <strong>Go + HTMX</strong>, demostrando arquitectura moderna de hipermedia sin frameworks pesados de JavaScript.
{{else}}
This interactive CV was built by myself with <strong>Go + HTMX</strong>, showcasing modern hypermedia architecture without heavy JavaScript frameworks.
{{end}}
{{.CV.UI.InfoModal.Description}}
</p>
<div class="info-modal-tech">
<div class="info-tech-item">
<iconify-icon icon="mdi:language-go" width="32" height="32"></iconify-icon>
<span>Go + Hono</span>
<span>{{.CV.UI.InfoModal.TechStack.GoHono}}</span>
</div>
<div class="info-tech-item">
<iconify-icon icon="mdi:lightning-bolt" width="32" height="32"></iconify-icon>
<span>HTMX</span>
<span>{{.CV.UI.InfoModal.TechStack.HTMX}}</span>
</div>
<div class="info-tech-item">
<iconify-icon icon="mdi:language-html5" width="32" height="32"></iconify-icon>
<span>Semantic HTML5</span>
<span>{{.CV.UI.InfoModal.TechStack.HTML5}}</span>
</div>
<div class="info-tech-item">
<iconify-icon icon="mdi:language-css3" width="32" height="32"></iconify-icon>
<span>Pure CSS3</span>
<span>{{.CV.UI.InfoModal.TechStack.CSS3}}</span>
</div>
</div>
<a href="https://github.com/juanatsap/cv-site" target="_blank" rel="noopener noreferrer" class="info-modal-github">
<iconify-icon icon="mdi:github" width="24" height="24"></iconify-icon>
<span>{{if eq .Lang "es"}}Ver código fuente{{else}}View Source Code{{end}}</span>
<span>{{.CV.UI.InfoModal.ViewSource}}</span>
<iconify-icon icon="mdi:arrow-right" width="20" height="20"></iconify-icon>
</a>
</div>