Yii2's message translation service translates a given text message from the source language to another by looking up the message to be translated in a message source file. If a message is found in a source for the target language, that string is returned instead of the original message. If the translated text is not found, Yii2 will return the original message.
The use of Yii2's message translation service is extremely straightforward. The first step toward translating messages in Yii2 is to wrap any and all messages you want translated in the
Yii::t() static method, which can be called as follows:
Yii::t('app', 'My message to be translated');
The first parameter indicates the category we want to store our messages in, and the ...