Add Spanish translation and language selector to website#128
Open
andyechc wants to merge 1 commit into
Open
Conversation
frankea
requested changes
Jul 4, 2026
frankea
left a comment
Owner
There was a problem hiding this comment.
Thanks @andyechc — this is a clean, self-contained approach (no dependencies, localStorage persistence, easy to revert). A few things to fix before it can go in, plus one decision that's on me.
Bugs:
- Image
altlocalization never runs.switchLangiteratesdocument.querySelectorAll('[data-en]'), but the<img>tags only carrydata-en-alt/data-es-alt(no baredata-en), so they're never selected — theel.hasAttribute('alt')branch is effectively dead code and the alt text never switches languages. - The first screenshot's English alt is Spanish.
data-en-alt="Creando un nuevo Wine bottle en Whisky"— both alts on that image are Spanish; thedata-en-altneeds the English string.
Worth tightening:
- Toggling to EN rewrites the visible English copy from
data-en, which has drifted from the static markup — it drops<em>by design</em>and changes "Apple's D3DMetal" → "Apple D3DMetal". Keep eachdata-enbyte-identical to the rendered fallback so clicking EN is a no-op. - The JS-swapped
<title>/ OG / Twittercontentwon't help SEO or social cards — crawlers and link scrapers don't execute JS, so they'll always read the static English. It only changes the live browser tab, where those meta values aren't user-visible. Not harmful, just won't do what the description implies for metadata.
The decision that's on me: i18n on a hand-maintained page means every future copy edit has to be mirrored across data-en + data-es, and drift (see #3) creeps in fast. I want to think about whether that maintenance overhead is worth it before merging — I'll follow up here. Nothing for you to change on that front; just being transparent that it's part of the call.
Fixes 1 and 2 are the blockers. Thanks again for the contribution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds full Spanish (es) translation to the Whisky homepage at
dist/pages/index.htmlwith a client-side language selector.Changes
localStorage<title>, Open Graph and Twitter Card meta tags are language-awarealtattributes switch with languagedata-en/data-esattributes on all translatable elements, JS swaps content and updates<html lang>Preview
Open the file in any browser and click "ES" in the top-right corner to switch languages. The choice persists across visits.