R
R
Ruslan2016-12-01 10:52:18
Yii
Ruslan, 2016-12-01 10:52:18

How to make a project in 2 languages ​​in Yii2?

There will be a project similar to https://ilovetorun.org/
How to properly translate such a project
1. Translation of content that is added through the admin panel
Make additional fields in the table for 2 languages? Or make a separate table where translation records will be added for each field. That is, the table table_name | field_name | language | translate
2. Translation of static texts on pages
For each text, do a translation through Yii::t() or are there any other options?
3. Is it really possible to translate the fact that users enter them in general?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2016-12-01
@alexantr

1. For content translation I use https://github.com/OmgDef/yii2-multilingual-behavior - main language content in one table, translations of multilingual fields in another table.
There is another solution where only data common to all languages ​​is stored in the main table : https://github.com/creocoder/yii2-translateable
y.
3. If you mean comments or information in the profile, then this will be superfluous.

3
3y3ik, 2016-12-01
@3y3ik

you can look aside https://github.com/yii2tech/ar-variation
this is from the core developer of Yii2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question