git clone https://github.com/fernandotonacoder/fernandotonacoder.github.io.git
cd fernandotonacoder.github.io
npm installLocal development: Open src/index.html in browser or use python -m http.server 8000 -d src
Branch protection is enabled. Always work on feature branches:
git checkout -b feature/your-feature
# make changes
git add .
git commit -m "Description"
git push origin feature/your-feature
# Create PR on GitHubCI/CD Pipeline:
- On PR: Tests, linting, format checks
- On merge to main: Auto-deploys to GitHub Pages
npm test # Run Jest tests
npm run lint # ESLint check
npm run lint:fix # Auto-fix linting issues
npm run format # Prettier format all files
npm run format:check # Check if formatted correctlyWhy custom instead of i18n library?
- No external dependencies
- Tiny footprint (~100 lines)
- Does exactly what we need, nothing more
Language detection priority:
- localStorage (
languagekey) - Browser language (
navigator.language) - Fallback to English
Translation keys: Flat structure in /locales/*.json. HTML elements use data-translate attributes:
data-translate="key"→ UpdatestextContentdata-translate-alt="key"→ Updatesaltattributedata-translate-html="key"→ UpdatesinnerHTML(supported but unused)
SEO: Dynamically updates <title>, <meta name="description">, and Open Graph tags on language change.
Why not a normal <select>?
- Needed custom styling (glassmorphism effect)
- Better control over appearance
- Still accessible with keyboard navigation
Color scheme: CSS variables in :root for easy theming
Icon colors: SVG filters for color manipulation:
/* White icons on dark background */
filter: brightness(0) invert(1);
/* Dark icons on light background */
filter: brightness(0) invert(0);Glassmorphism effect:
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);Why flat config (eslint.config.mjs)?
- ESLint 9+ requires it
- Different environments need different globals:
- Browser JS:
setLanguage,getCurrentLanguage(custom globals) - Test files: Jest globals (
describe,test,expect) - Jest config: Node.js globals (
module)
- Browser JS:
Why these settings?
- Double quotes, no trailing commas, always parens → Personal preference from TypeScript/C# background
tabWidth: 4→ Personal preference from C# background
- Add key to ALL locale files (
en.json,es.json,fr.json,pt.json) - Add
data-translate="yourKey"to HTML element - Test in all languages
- Create
/locales/{lang}.jsonwith all existing keys - Update
supportedLangsinjs/translations.js - Update
languageNamesinjs/custom-select.js - Add option to language selector in
index.html - Write tests
Tests failing?
- Make sure JSON files don't have trailing commas (Prettier removes them automatically)
- Run
npm test -- --clearCacheif weird caching issues
Translations not loading?
- Check browser console for fetch errors
- Verify JSON is valid
- Check file paths are correct
Styles not applying?
- Hard refresh:
Ctrl+Shift+R(Windows/Linux) orCmd+Shift+R(Mac)
Can't push to main?
- That's intentional. Create a feature branch and PR.
What we test:
- Translation system: Loading, language switching, localStorage persistence
- Custom selector: UI interactions, language selection
What we don't test:
- Bootstrap components (already tested by Bootstrap)
- Browser APIs (fetch, localStorage)
- CSS styling
Coverage target: No specific target, just test critical logic.
--clr-navy: #001f3f; /* Primary background */
--clr-blue-text: #2563eb; /* Accent text */
--clr-linkedin: #0077b5;
--clr-github: #333;0 = 0, 1 = 4px, 2 = 8px, 3 = 16px, 4 = 24px, 5 = 48px
- Mobile first approach
- Key breakpoint: 992px (tablets → desktop)
- Jest Docs
- ESLint Flat Config
- Bootstrap 5
- CSS Filter Generator for SVG colors