How to organize multilingual?

Good evening gentlemen.

How to create multilingual templates and distribute

— okay, but what about the content of the site? After all, there are several ways.

I am interested in unlimited number of languages, i.e. in a separate table, we store the language id and its title, and when you create, for example, a text page, specify what lang_id we add/edit. And here I was faced with questions that in my head laid out on the shelves: languages can be either an independent structure and a mirror; the gallery is unlikely to be different — you need to do the mirror.

Can anyone have working examples of how it's implemented? I would be very grateful if you show how you create multilingual sites, for example text pages.
October 8th 19 at 02:05
2 answers
October 8th 19 at 02:07
Galleries can also contain language, especially if the images contain text. If any entry does not specify a language, set the language to "unknown" or null, which receives requests in other languages, roughly where lang in ('EN', 'en', 'unknown') or where lang = 'EN' or lang is null. There is still a specific objective, when the entity should be in multiple languages, but it is difficult to implement, especially on RDBMS. Other databases can be enhanced for example in MongoDB a query of all articles in English and undetermined languages in category 123 will look something like this: find({lang:{$in:['en','EN','unknown']}, category: 123}) will use an index on lang and in the sample will fall as the articles lang:'en' or lang: 'default', and, for example, lang: ['en', 'en-US']
Thank you, and you can sample code to lead? Because it is difficult to sort through.
With galleries you are right. I had in mind: images for all languages are the same, but the description and the category name is different.

I understand that the Create table languages:
lang_id | lang_name
1 | EN
2 | eng

lang_id — to not a problem, so there is helpers that parse the links and assign the desired lang_id. Also, there is no problem in the localization js scripts.

How here, for simplicity, with text pages, and menus to be? For example, the text page and make a menu. For example, fill the Russian version: the primary objective of BCC = 1; txt = "Russian link 1" and lang_id = 1.
Create for the English version, but it's page_id = 2. How to organize when you change the language, retaining the same page but in English?

Or, as better back-end to implement the work with multilingual: Assume only one text field. Automatically open the tab "Rus" and, in parallel, offer the other languages that we have in the settings? Or is it better to do the language switch: ie, the session of the Russian — only for the Russian language. Switched to English — all English. - darion.Muell commented on October 8th 19 at 02:10
Codes can directly write in the form of ISO 639, operate on the indices did not seem much slower intov. The reference I used only to decrypt (en -> English). About aydishnikov — in the case of multilingual articles add a field "code page", add a new article to insert a number from sequence, and when davlenii language to the current article to take existing code and new language. When installing the relationship to the article it will be possible to use this code, in addition, for installing relations to a specific version of the article you can use her PK. Still, you can probably use composite primary keys, but I do not like them.

The runtime of the query (front-end) must contain a notion of the current language interface and language (languages), which(e) the user wants to see. They are passed into calls to the model (the backend). The interface language is clear — it we derive menus, button names and other trappings. The default is determined from the Accept-Language header with the option to change in settings or a cookie. In a language that the user wants to see much more complicated and strongly depends on the task and business logic. For example, if it is something like Twitter, when a user in the settings put "to see the English and German tweets", then it is necessary to withdraw the tape from them, choosing both languages at once. - emmitt_Kohl commented on October 8th 19 at 02:13
October 8th 19 at 02:09

There are only 4 ways, and this No. 3 at cool =) Although if "interested for an unlimited number of languages", the choice is correct, only it is necessary to use ISO codes rather than custom.

I made a special default router in Zend FW, that has always worked as you have —

Find more questions by tags Zend FrameworkInternationalization and localization