Answer the question
In order to leave comments, you need to log in
What is the easiest way to make a bilingual site?
Here's what I googled. I saw such options, there is a site site.com/en or site.com/ru i.e. I chose a language, for example Russian, and if I go to the page about us, it will be something like that site.com/ru/o_nas; if in English, then site.com/en/o_nas i.e. there is a page en and ru and it works through them.
I need that when I click on en|ru, respectively, the site will be completely twisted and which page I would not go to, it would be in the selected language. At the expense of cookies and sessions, they are not important now, the main thing is that until the browser is closed, the language remains selected until the user switches to another one.
OOP and the like are not needed, the simplest is procedural.
Everything is taken from the database, as I understand it, if there are 2 languages, then you need to create 2 tables o_nas_ru and o_nas_en and, provided that you write in the right one. But in practice it doesn't.
I also saw this index.php? lang-en or index.php? lang-ru, these get parameters are added when you click on the language selection and let's say the main one has been translated, although I haven't succeeded yet. but if you go to site.com/o_nas then these get parameters disappear.
What I coded:
block I language switching.
<div class="tag">Language:<a href="index.php?lang-en">English</a>|<a href="index.php?lang=ru">Русский</div>
Answer the question
In order to leave comments, you need to log in
As an option, in the tables with the content, you can add the language field, where the id or ISO code of the language will be stored accordingly, according to which the necessary records will be loaded.
those.
will load posts with language == 'en'.
Generally speaking, the principle is
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question