PHP 클래스 lajax\translatemanager\Module

Initialisation example: Simple example: ~~~ 'modules' => [ 'translatemanager' => [ 'class' => 'lajax\translatemanager\Module', ], ], ~~~ Complex example: ~~~ 'modules' => [ 'translatemanager' => [ 'class' => 'lajax\translatemanager\Module', 'root' => '@app', // The root directory of the project scan. 'layout' => 'language', // Name of the used layout. If using own layout use 'null'. 'allowedIPs' => ['127.0.0.1'], // IP addresses from which the translation interface is accessible. 'roles' => ['@'], // For setting access levels to the translating interface. 'tmpDir' => '@runtime', // Writable directory for the client-side temporary language files. IMPORTANT: must be identical for all applications (the AssetsManager serves the JavaScript files containing language elements from this directory). 'phpTranslators' => ['::t'], // list of the php function for translating messages. 'jsTranslators' => ['lajax.t'], // list of the js function for translating messages. 'patterns' => ['*.js', '*.php'],// list of file extensions that contain language elements. 'ignoredCategories' => ['yii'], // these categories won’t be included in the language database. 'ignoredItems' => ['config'], // these files will not be processed. 'languageTable' => 'language', // Name of the database table storing the languages. 'scanTimeLimit' => null, // increase to prevent "Maximum execution time" errors, if null the default max_execution_time will be used 'searchEmptyCommand' => '!', // the search string to enter in the 'Translation' search field to find not yet translated items, set to null to disable this feature 'defaultExportStatus' => 1, // the default selection of languages to export, set to 0 to select all languages by default 'defaultExportFormat' => 'json',// the default format for export, can be 'json' or 'xml' 'tables' => [ // Properties of individual tables [ 'connection' => 'db', // connection identifier 'table' => '{{%language}}', // table name 'columns' => ['name', 'name_ascii'], //names of multilingual fields 'category' => 'database-table-name', // the category is the database table name ] ] ], ], ~~~ IMPORTANT: If you want to modify the value of roles (in other words to start using user roles) you need to enable authManager in the common config. Using of authManager: http://www.yiiframework.com/doc-2.0/guide-security-authorization.html examples: PhpManager: ~~~ 'components' => [ 'authManager' => [ 'class' => 'yii\rbac\PhpManager', ], ], ~~~ DbManager: ~~~ 'components' => [ 'authManager' => [ 'class' => 'yii\rbac\DbManager', ], ], ~~~
부터: 1.0
저자: Lajos Molnár ([email protected])
상속: extends yii\base\Module
파일 보기 프로젝트 열기: lajax/yii2-translate-manager 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$allowedIPs the list of IPs that are allowed to access this module.
$connection The default db connection
$controllerNamespace
$defaultExportFormat The default export format (yii\web\Response::FORMAT_JSON or yii\web\Response::FORMAT_XML).
$defaultExportStatus The minimum status for a language to be selected by default in the export list.
$defaultRoute
$googleApiKey google API Key for using with google translate service (v2). Default is false - google translate will not be available.
$ignoredCategories list of the categories being ignored.
$ignoredItems directories/files being ignored.
$jsTranslators List of the JavaScript function for translating messages.
$languageTable The database table storing the languages.
$layout name of the used layout. If you want to use the site default layout set value null.
$patternArray PHP Regular expression to match arrays containing language elements to translate.
$patternArrayRecursive PHP Regular expression to detect langualge elements within arrays.
$patternArrayTranslator PHP Regular expression to match arrays containing language elements to translate.
$patternJs Regular expression to detect JavaScript lajax.t functions.
$patternPhp Regular expression to match PHP Yii::t functions.
$patterns list of file extensions that contain language elements. Only files with these extensions will be processed.
$phpTranslators List of the PHP function for translating messages.
$roles the list of rights that are allowed to access this module. If you modify, you also need to enable authManager. http://www.yiiframework.com/doc-2.0/guide-security-authorization.html
$root The root directory or directories of the scanning. The path can be an alias or a full path. It is possible to define one root directory as string. In this case the scanRootParentDirectory will be used when determining the actual directory to scan. Multiple root directories can be declared in an array. In this case all items must point to the exact directory, as scanRootParentDirectory **will be omitted**.
$scanRootParentDirectory Whether scan the defined root parent directory, or the folder itself. This option is used only, when the root option contains a single directory as string (e.g. 'root' => '@app'). IMPORTANT: Changing this from true to false could cause loss of translated items, as optimize action removes the missing items. If the configured root is @app: - true means for advanced apps, that the scan runs on the parent directory, which is the root for the entire project. This is the desired behavior. - true means for basic apps, that the scan runs also on the parent directory, which is outside of the project folder (as @app is equals to the project root). This is not desired behavior, it is preferred to change this option to false.
$scanTimeLimit The max_execution_time used when scanning, when set to null the default max_execution_time will not be modified.
$scanners Scanners can be overriden here. If not set original set of scanners will be used from Scanner
$searchEmptyCommand The search string to find empty translations.
$subDir name of the subdirectory which contains the language elements.
$tables ~~~ $tables = [ [ 'connection' => 'db', // connection identifier. 'table' => '{{%language}}', // name of the database table to scan. 'columns' => ['name', 'name_ascii'] // fields to check. ], [ 'connection' => 'db', // connection identifier. 'table' => '{{%post}}', // name of the database table to scan. 'columns' => ['title', 'description', 'content']// fields to check. ], ]; ~~~
$tmpDir writeable directory used for keeping the generated javascript files.

공개 메소드들

메소드 설명
beforeAction ( $action )
checkAccess ( ) : boolean
getLanguageItemsDirPath ( ) : string

메소드 상세

beforeAction() 공개 메소드

public beforeAction ( $action )

checkAccess() 공개 메소드

public checkAccess ( ) : boolean
리턴 boolean whether the module can be accessed by the current user

getLanguageItemsDirPath() 공개 메소드

public getLanguageItemsDirPath ( ) : string
리턴 string The full path of the directory containing the generated JavaScript files.

프로퍼티 상세

$allowedIPs 공개적으로 프로퍼티

the list of IPs that are allowed to access this module.
public $allowedIPs

$connection 공개적으로 프로퍼티

The default db connection
public $connection

$controllerNamespace 공개적으로 프로퍼티

public $controllerNamespace

$defaultExportFormat 공개적으로 프로퍼티

The default export format (yii\web\Response::FORMAT_JSON or yii\web\Response::FORMAT_XML).
public $defaultExportFormat

$defaultExportStatus 공개적으로 프로퍼티

The minimum status for a language to be selected by default in the export list.
public $defaultExportStatus

$defaultRoute 공개적으로 프로퍼티

public $defaultRoute

$googleApiKey 공개적으로 프로퍼티

google API Key for using with google translate service (v2). Default is false - google translate will not be available.
public $googleApiKey

$ignoredCategories 공개적으로 프로퍼티

list of the categories being ignored.
public $ignoredCategories

$ignoredItems 공개적으로 프로퍼티

directories/files being ignored.
public $ignoredItems

$jsTranslators 공개적으로 프로퍼티

List of the JavaScript function for translating messages.
public $jsTranslators

$languageTable 공개적으로 프로퍼티

The database table storing the languages.
public $languageTable

$layout 공개적으로 프로퍼티

name of the used layout. If you want to use the site default layout set value null.
public $layout

$patternArray 공개적으로 프로퍼티

PHP Regular expression to match arrays containing language elements to translate.
사용 중단: since version 1.2.7
public $patternArray

$patternArrayRecursive 공개적으로 프로퍼티

PHP Regular expression to detect langualge elements within arrays.
사용 중단: since version 1.2.7
public $patternArrayRecursive

$patternArrayTranslator 공개적으로 프로퍼티

PHP Regular expression to match arrays containing language elements to translate.
public $patternArrayTranslator

$patternJs 공개적으로 프로퍼티

Regular expression to detect JavaScript lajax.t functions.
사용 중단: since version 1.2.7
public $patternJs

$patternPhp 공개적으로 프로퍼티

Regular expression to match PHP Yii::t functions.
사용 중단: since version 1.2.7
public $patternPhp

$patterns 공개적으로 프로퍼티

list of file extensions that contain language elements. Only files with these extensions will be processed.
public $patterns

$phpTranslators 공개적으로 프로퍼티

List of the PHP function for translating messages.
public $phpTranslators

$roles 공개적으로 프로퍼티

the list of rights that are allowed to access this module. If you modify, you also need to enable authManager. http://www.yiiframework.com/doc-2.0/guide-security-authorization.html
public $roles

$root 공개적으로 프로퍼티

The root directory or directories of the scanning. The path can be an alias or a full path. It is possible to define one root directory as string. In this case the scanRootParentDirectory will be used when determining the actual directory to scan. Multiple root directories can be declared in an array. In this case all items must point to the exact directory, as scanRootParentDirectory **will be omitted**.
public $root

$scanRootParentDirectory 공개적으로 프로퍼티

Whether scan the defined root parent directory, or the folder itself. This option is used only, when the root option contains a single directory as string (e.g. 'root' => '@app'). IMPORTANT: Changing this from true to false could cause loss of translated items, as optimize action removes the missing items. If the configured root is @app: - true means for advanced apps, that the scan runs on the parent directory, which is the root for the entire project. This is the desired behavior. - true means for basic apps, that the scan runs also on the parent directory, which is outside of the project folder (as @app is equals to the project root). This is not desired behavior, it is preferred to change this option to false.
public $scanRootParentDirectory

$scanTimeLimit 공개적으로 프로퍼티

The max_execution_time used when scanning, when set to null the default max_execution_time will not be modified.
public $scanTimeLimit

$scanners 공개적으로 프로퍼티

Scanners can be overriden here. If not set original set of scanners will be used from Scanner
public $scanners

$searchEmptyCommand 공개적으로 프로퍼티

The search string to find empty translations.
public $searchEmptyCommand

$subDir 공개적으로 프로퍼티

name of the subdirectory which contains the language elements.
public $subDir

$tables 공개적으로 프로퍼티

~~~ $tables = [ [ 'connection' => 'db', // connection identifier. 'table' => '{{%language}}', // name of the database table to scan. 'columns' => ['name', 'name_ascii'] // fields to check. ], [ 'connection' => 'db', // connection identifier. 'table' => '{{%post}}', // name of the database table to scan. 'columns' => ['title', 'description', 'content']// fields to check. ], ]; ~~~
public $tables

$tmpDir 공개적으로 프로퍼티

writeable directory used for keeping the generated javascript files.
public $tmpDir