Hector Portfolio is fully bilingual. Every user-facing string is stored in translation files and resolved at runtime throughDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/iwinser117/react-portafolio/llms.txt
Use this file to discover all available pages before exploring further.
i18next and its React binding react-i18next. Visitors can switch between Spanish and English at any time via the Settings panel, and their choice is remembered across sessions.
Libraries
| Package | Role |
|---|---|
i18next | Core internationalisation framework |
react-i18next | React hooks and components that wrap i18next |
Configuration — src/locales/i18nConfig.js
The config file bootstraps i18next once on application start. It imports both JSON translation bundles, registers them as resources, and reads the user’s saved language from localStorage — falling back to Spanish ('es') if nothing is stored.
| Option | Value | Meaning |
|---|---|---|
lng | localStorage.getItem('language') || 'es' | Active language at startup |
fallbackLng | 'es' | Used when a key is missing in the active language |
escapeValue | false | Disables double-escaping (React handles XSS) |
Translation Files
Both files live insrc/locales/ and share the same namespace structure. They use a single flat translation namespace (set in i18nConfig.js) whose top-level keys logically group strings by section.
Top-level namespaces
| Key | Description |
|---|---|
nav | Navigation link labels |
banner | Hero section — title, description, social links |
about | About section — greeting, name, descriptions |
skills | Skills section — title and technology descriptions |
projects | Projects page — titles, search, labels |
contact | Contact form — labels, placeholders, messages |
settings | Settings modal — theme and language option labels |
Aside | Sidebar — contact me link |
projects namespace (full structure)
Using Translations in a Component
CalluseTranslation() to obtain the t function, then pass the dot-separated key path as a string. The function returns the string for the currently active language.
Switching Language at Runtime
SettingsModal calls i18n.changeLanguage() and immediately persists the selection to localStorage so that the choice survives a full page reload (the config file reads this value on init).
i18n.language against the button’s locale code.
Adding a New Translation Key
Add the key to en.json
Open
src/locales/en.json and add your new key under the appropriate top-level namespace (or create a new one).Add the key to es.json
Open
src/locales/es.json and add the matching Spanish translation under the same namespace path.Because
fallbackLng is set to 'es', a key that exists in es.json but is missing from en.json will still render the Spanish string rather than the raw key. Always add keys to both files to avoid unintended language bleed.