LorcanaJSON / LorcanaJSON-website

The sourcecode of the LorcanaJSON website
https://lorcanajson.org/index.html
MIT License
0 stars 1 forks source link

Translating the site - ideas #1

Open Yopai opened 6 months ago

Yopai commented 6 months ago

There are multiple ways to translate the site; I'll put them here to be able to have a discussion about them and we can pick one.

1) create a static fr/index.html Advantages: simple, well-separated. Disadvantages: if it is needed to change the site structure, both files must be modified

2) write both in the same html file, and only show one language Either all english, then all french;

<p lang="en">This is a wonderful site</p>
<p lang="en">A second sentence</p>
<p lang="fr">C'est un merveilleux site</p>
<p lang="fr">Une deuxième phrase</p>

Or english block, then french block

<p lang="en">This is a wonderful site</p>
<p lang="fr">C'est un merveilleux site</p>
<p lang="en">A second sentence</p>
<p lang="fr">Une deuxième phrase</p>

Advantages: All text is kept in the html file. Disadvantages: Having both languages in the same file can be difficult to read.

3) Put text in language javascript files Something like what is done here : https://medium.com/@nohanabil/building-a-multilingual-static-website-a-step-by-step-guide-7af238cc8505

in index.html:
<p data-i18n="translation-key-for-my-message">
in en.js:
{
    "translation-key-for-my-message": "This is my message";
}
in fr.js:
{
    "translation-key-for-my-message": "Ceci est mon message";
}

Advantages: Separate the HTML structure and the text; easier to translate Disadvantages: Text is not in the HTML file anymore; we have to find a translation key for each text block

Using Javascript also mean two possibilities :

What do you think ? Which one of these do you prefer ?

Didero commented 6 months ago

I prefer the simplicity of the first solution, just having separate HTML files for each language. The HTML files aren't huge, and there are only a few languages, so the disadvantage you list shouldn't be that big of an issue.

Yopai commented 6 months ago

Ok. Then the redesign must be done first, because every change in it will have to be reflected in every file. I don't know what server lorcanajson.org is hosted on; aother solution would be to generate the file with some server-side scripting language like php