Translate large paragraph

Hi,

I’m looking for internationalization and found that it can be done by following:


echo \Yii::t('app', 'This is a string to translate!');

but how to apply this for large amount of texts, like paragraph? does each line needed to be separated? or is there any better ways available?

Thanks in advance!

Hi Nishu,




echo \Yii::t('app','your.key.to.script'); //app -> represents the file name of the language you represent typically app.php inside your internationalized 2 digit lower case language key as folder name 



The above code is to deliver the translated to text to the users.

The actual logic behind is the key "your.key.to.script" represents a short message key to identify the related translations. For example if you want to translate in English.

Your source folder > messages > en > app.php




return [

'your.key.to.script' => 'This is a strong to translate'

];



Please read the document for more info https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n

Hi Nishu,

You may consider translating the whole view when you have to translate a large amount of texts.

Guide > i18n > View Translation

https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n#view-translation