Answer the question
In order to leave comments, you need to log in
What is the best way to implement multilingualism on the site?
The following question arose, it is necessary to work out the structure of the site in several languages.
Let's immediately move away from the idea of squinting and hooking on all sorts of Google translators and the like.
There are several issues in the implementation of this case:
1) For example, we have a table "news" project news:
news_id
title
news_short
news_full
status
title_ru
title_en
news_short_en
news_full_en
news_short_ru
news_full_ru
...
tr_id
lang
title
news_short
news_full
news_id
views
- ru
- news_full.tpl
- news_short.tpl
- en
- news_full.tpl
- news_short.tpl
...
array(
'Неверный пароль' => 'Wrong Password'
)
Answer the question
In order to leave comments, you need to log in
1) of course the second option. every time you add a new language to remake the table - not comme il faut.
2) Do your templates for different languages differ visually? I usually make one template, and put all the standard texts (button labels, etc.) into language files/classes. Those. I actually have one template, it's just that in addition to the actual content of the article, it also goes through the stage of inserting all the standard texts from the current language file.
3) The same as in question number 2. I make my own file for each language, which I load before I start working with the view. From it I take all the text constants, whether they are labels on buttons or error messages. From base at an error only the code comes. According to this code, I take the text from a text file and send it to the client.
#2-3
gettext po, i18n
stackoverflow.com/questions/2319060/using-php-gett...
blog.lingohub.com/developers/2013/07/php-internati...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question