helpers\BaseFileHelper localize()

localize() public static method

Returns the localized version of a specified file.

The searching is based on the specified language code. In particular, a file with the same name will be looked for under the subdirectory whose name is the same as the language code. For example, given the file "path/to/view.php" and language code "zh-CN", the localized file will be looked for as "path/to/zh-CN/view.php". If the file is not found, it will try a fallback with just a language code that is "zh" i.e. "path/to/zh/view.php". If it is not found as well the original file will be returned.

If the target and the source language codes are the same, the original file will be returned.

public static string localize ( $file, $language = null, $sourceLanguage = null )
$file string

The original file

$language string

The target language that the file should be localized to. If not set, the value of yii\base\Application::$language will be used.

$sourceLanguage string

The language that the original file is in. If not set, the value of yii\base\Application::$sourceLanguage will be used.

return string

The matching localized file, or the original file if the localized version is not found. If the target and the source language codes are the same, the original file will be returned.

doc_Yii
2016-10-30 17:04:45
Comments
Leave a Comment

Please login to continue.