skip to Main Content

I have a website I’m working on that I wish to add another few (properly translated) language options for, and I can’t find as much readily accessible information as I thought I could on producing a multilingual website.

There’s a nice amount of information on how to structure your URL schema (with .com/LANGUAGE being the nicest), but if you have http://www.example.com/en/, http://www.example.com/fr, and http://www.example.com/de — then for a static site, how do you avoid manually duplicating code just to drop-in each language’s strings?

My site has about 8 webpages with on average 400 words of content on each page. It’s not enough content to require a database for. However, the website is still in development and I don’t want to wait until the ‘end’ (it’s an informational tool) of its development cycle to create static versions for each language. I also don’t want to swap out variables server-side because I am under the impression this will greatly diminish SEO scoring?

So, without much information of the topic available to me, I have devised a system/program that I would like some feedback of feasibility on – or if an alternative exists (?), before I begin.

  • I am planning on creating master versions of each .html file (the
    only file that I actually edit for code changes) that contains a unique variable string for each instance of text
  • Create /language directories for each language, copying over all files from the master
  • Create a JSON file, structured appropriately to contain language strings for each variable
  • Using a small C program, parse each language into the appropriate variables for each language’s .html file

…As I am using .git, I would also copy over only changes that need to be made, by comparing strings against existing variables. — The way I could compare files I have not yet thought through — was thinking of storing the variable for each string as a .html tag so that it is always existent in the file.

Does anybody know if a tool like this exists, or if there is a much more compelling and SEO-compliant method of performing this?

Thanks in advance.

2

Answers


  1. I found what may be exactly what we want: Statirator

    plus solutions with Jekyll, thanks to the answer of smit1678.

    Statirator (or frozen-django)

    which can be viewed as frozen-django (frozen-flask is a popular app).

    It’s on pypi:

    pip install statirator # you may need to create a virtual env beforehand
    

    then

    statirator init mysite
    

    it creates a skeleton project.

    statirator create_post
    

    it creates one rst file divided in as many sections as we configured languages

    statirator generate
    

    will generate the static site. It uses the Django configuration, so it’s like frozen-django.

    Unfortunately, it’s not maintained and I couldn’t make it work myself yet… (either I can’t install it either statirator init doesn’t exist).

    Unfortunately again /r/python didn’t attract many interest at all.

    With Jekyll

    I had found good explanations to configure Jekyll as a multilingual site. Now came the examples: (quoting Natan)

    Login or Signup to reply.
  2. edit, 2020: now I’d go with Hugo (or equivalent). Hugo is easier to install, has many more features, is much faster, has more themes, has a bigger community.

    A great solution, which appeared in december, 2015, is Lektor, a "static Content Management System".

    It’s a static site builder with a built-in admin UI (to write posts and configure). Its system of "alternatives" is designed to localize and translate websites: https://www.getlektor.com/docs/content/alts/

    pip install Lektor
    lektor quickstart 
    

    It’s a well established solution. Btw, it’s by the creator of Flask.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search