DEV Community

Discussion on: Help: How to make a multilanguage website?

Collapse
aurelio profile image
Aurelio • Edited on

If you're building a static website I would say you have 3 options:

  1. 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.

  2. 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.

  3. 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).

Collapse
cecilelebleu profile image
Cécile Lebleu Author

This is awesome! Thanks a lot for your answer. I'll take a look at all your suggestions. I never would have thought of using CSS — wow! I wonder how I could make that work across different pages: if you change the language on page A and then go to page B it should stay in the same language. I think it might be doable, and sounds possibly even easier to maintain than duplicate pages.
Anyway, thanks a lot for your time! Great suggestions here!

Collapse
aurelio profile image
Aurelio

Happy you liked, I should probably mention Jekyll is supported out of the box for free on Github. There are a lot of tutorials online that show how plus the official docs of course.

The bottom line is that you would have a website live for free (and with a few dollars a year you can add your own domain name), it will be easy to update, plus it would be actually be a good solution to you multi lang requirement. All things considered that's the option I would choose, I use it for my own website and it's very easy and convenient (and free)!

Cheers!