Abstract Class lajax\translatemanager\services\scanners\ScannerFile
Inheritance | lajax\translatemanager\services\scanners\ScannerFile » yii\console\controllers\MessageController |
---|---|
Subclasses | lajax\translatemanager\services\scanners\ScannerJavaScriptFunction, lajax\translatemanager\services\scanners\ScannerPhpArray, lajax\translatemanager\services\scanners\ScannerPhpFunction |
Available since version | 1.1 |
Class for processing PHP and JavaScript files.
Language elements detected in JavaScript files:
lajax.t('language element);
lajax.t('language element {replace}', {replace:'String'});
lajax.t("language element");
lajax.t("language element {replace}", {replace:'String'});
Language elements detected in PHP files: "t" functions:
::t('category of language element', 'language element');
::t('category of language element', 'language element {replace}', ['replace' => 'String']);
::t('category of language element', "language element");
::t('category of language element', "language element {replace}", ['replace' => 'String']);
Language elements detected in constant arrays:
/**
* @translate
*/
private $_GENDERS = ['Male', 'Female'];
/**
* @translate
*/
private $_STATUSES = [
self::STATUS_ACTIVE => 'Active',
self::STATUS_INACTIVE => 'Inactive'
];
Translation of constant arrays: Translation to site language:
$genders = \lajax\translatemanager\helpers\Language::a($this->_GENDERS);
Translating to the language of your coice:
$statuses = \lajax\translatemanager\helpers\Language::a($this->_STATUSES, [], 'de-DE');
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$module | lajax\translatemanager\Module | TranslateManager Module | lajax\translatemanager\services\scanners\ScannerFile |
$scanner | lajax\translatemanager\services\Scanner | Object. | lajax\translatemanager\services\scanners\ScannerFile |
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$files | array | Array to store patsh to project files. | lajax\translatemanager\services\scanners\ScannerFile |
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | lajax\translatemanager\services\scanners\ScannerFile | |
init() | lajax\translatemanager\services\scanners\ScannerFile |
Protected Methods
Method | Description | Defined By |
---|---|---|
checkTokens() | lajax\translatemanager\services\scanners\ScannerFile | |
extractMessages() | Extracts messages from a file | lajax\translatemanager\services\scanners\ScannerFile |
getLanguageItem() | Returns language elements in the token buffer. | lajax\translatemanager\services\scanners\ScannerFile |
isValidCategory() | Determines whether the category received as a parameter can be processed. | lajax\translatemanager\services\scanners\ScannerFile |
Constants
Constant | Value | Description | Defined By |
---|---|---|---|
EXTENSION | '*.php' | Extension of PHP files. | lajax\translatemanager\services\scanners\ScannerFile |
Property Details
Array to store patsh to project files.
TranslateManager Module
Object.
Method Details
public void __construct ( lajax\translatemanager\services\Scanner $scanner ) | ||
$scanner | lajax\translatemanager\services\Scanner |
protected void checkTokens ( $options, $translatorTokens, $tokens ) | ||
$options | Definition of the parameters required to identify language elements. |
|
$translatorTokens | Translation identification |
|
$tokens | Tokens to search through |
Extracts messages from a file
protected void extractMessages ( $fileName, $options, $ignoreCategories = [] ) | ||
$fileName | string | Name of the file to extract messages from |
$options | array | Definition of the parameters required to identify language elements. example:
|
$ignoreCategories | array | Message categories to ignore Yii 2.0.4 |
Returns language elements in the token buffer.
If there is no recognisable language element in the array, returns null.
protected abstract void getLanguageItem ( $buffer ) | ||
$buffer |
public void init ( ) |
Determines whether the category received as a parameter can be processed.
protected boolean isValidCategory ( $category ) | ||
$category | string |