Property | Type | Description | |
---|---|---|---|
$forceTranslation | whether to force message translation when the source and target languages are the same. Defaults to false, meaning translation is only performed when source and target languages are different. | ||
$sourceLanguage | the language that the original messages are in. If not set, it will use the value of [[\yii\base\Application::sourceLanguage]]. |
Method | Description | |
---|---|---|
init ( ) | Initializes this component. | |
translate ( string $category, string $message, string $language ) : string | boolean | Translates a message to the specified language. |
Method | Description | |
---|---|---|
loadMessages ( string $category, string $language ) : array | Loads the message translation for the specified language and category. | |
translateMessage ( string $category, string $message, string $language ) : string | boolean | Translates the specified message. |
public translate ( string $category, string $message, string $language ) : string | boolean | ||
$category | string | the message category |
$message | string | the message to be translated |
$language | string | the target language |
return | string | boolean | the translated message or false if translation wasn't found or isn't required |
protected translateMessage ( string $category, string $message, string $language ) : string | boolean | ||
$category | string | the category that the message belongs to. |
$message | string | the message to be translated. |
$language | string | the target language. |
return | string | boolean | the translated message or false if translation wasn't found. |
public $forceTranslation |