Hi everyone!
I'm building a website the simple way — HTML, CSS, and vanilla JavaScript, that's it. I'm trying to keep it as light and simple as I can. It's looking pretty good so far, but everything is in English and I will eventually need to add translations, mainly Spanish in the very near future, but then probably a couple more. (I can do the translation part).
I have been looking around for options and tools to implement this. My first thought was, since the site is static, only has about 5 pages, (and mostly because I have the time and enthusiasm to do it and keep it updated in more than one language), I'll just do it all by hand! When everything is about ready in English, I'll just duplicate the pages, translate the content, and add a button to switch between the different versions of the same page — manually linking each page. Yes, I actually consider this a viable option. Please don't judge!
Most of the answers, tutorials, and solutions I've found include using a CMS (which I don't think this site needs, and again, I'm trying to keep it as bloat-free as possible. Heck, I've been avoiding jQuery, even though it means writing some functionality from scratch. I like the challenge.)
Or they suggest using PHP or MySQL, which I know the basics of, but definitely would entail a learning curve, and again — keeping it as light as possible.
Or they suggest using the Google Translate API, which...just, no.
Get to the question already!
So my question is, is this actually doable? Have you done it before? Is it insane? Any tips, for example, on how to keep the same content on different pages related, in the eyes of search engines' robots?
Or, am I delusional, and should I give up and add in some PHP? If so, how would you do it? Any guides, or tutorials, ideas, etc?
I would highly appreciate any help, tips, links, funny judgmental gifs, or anything else in the comments!










If you're building a static website I would say you have 3 options:
duplicating - no one likes this word, but if you know you'll be updating your site very rarely, if ever, that could actually be a simple option that does the job, so why not. If you know you'll be updating it, better chose another way.
use some 3rd party libs that help you with this. A quick Google search shows i18next and Lingumania. Both can be included via a script tag so that very easy to add. The second looks a bit nicer as an API, but the first looks more supported and stable. Never used either of them so I can't really say.
come up with some other crazy solution like doing in CSS (it will work though!).
These are the options I see for a static website.
If instead you're up for the challenge and want to try another approach, PHP is one them, but purely frontend solutions like React, Vue or Angular will open you some more options, surely nicer than the ones you have on static website.
In any case, good luck and have fun, hope that was helpful in some way!
ps - now that I think of it another option you can look into is a static site generator like Jekyll. The learning curve is very manageable, you'd be working mainly with html and it definitely supports internationalisation. An example (this article is about building a blog, but you can easily publish "normal" pages with Jekyll and build a small website that is easy to update when you need to).