- Arrays
- DataMapper
- DB
- DB
- Dummy
- Exception
- HTML
- HTML
- HTMLFragment
- JSON
- LanguageException
- Method
- MethodException
- Module
- RequestException
- Rest
- Rest
- Strings
- Text
- Translation
- TranslationException
- URL
- URL
- XML
- XML
- Full name: \NovemBit\i18n\system\helpers\Arrays
Recursive array walk with callback and route
Arrays::arrayWalkWithRoute( array &$arr, callable $callback, \NovemBit\i18n\system\helpers\Strings $route = '', \NovemBit\i18n\system\helpers\Strings $separator = '>' ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$arr |
array | Main array |
$callback |
callable | Callback function with 3 params (key/val/route) |
$route |
\NovemBit\i18n\system\helpers\Strings | Parent route |
$separator |
\NovemBit\i18n\system\helpers\Strings | Route separator |
array_merge_recursive does indeed merge arrays, but it converts values with duplicate keys to arrays rather than overwriting the value in the first array with the duplicate value in the second array, as array_merge does. I.e., with array_merge_recursive, this happens (documented behavior):
Arrays::arrayMergeRecursiveDistinct( array &$array1, array &$array2 ): array
array_merge_recursive(array('key' => 'org value'), array('key' => 'new value')); => array('key' => array('org value', 'new value'));
array_merge_recursive_distinct does not change the datatypes of the values in the arrays. Matching keys' values in the second array overwrite those in the first array, as is the case with array_merge, i.e.:
array_merge_recursive_distinct(array('key' => 'org value'), array('key' => 'new value')); => array('key' => array('new value'));
Parameters are passed by reference, though only for performance reasons. They're not altered by this function.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$array1 |
array | |
$array2 |
array |
ActiveRecord class. Child of Yii ActiveRecord library
- Full name: \NovemBit\i18n\models\DataMapper
See Also:
DataMapper::getDB( ): \Doctrine\DBAL\Connection
- This method is static.
DB component
Its simple but provides very useful functionality Module class
- Full name: \NovemBit\i18n\system\component\DB
- Parent class: \NovemBit\i18n\system\Component
See Also:
Component constructor.
DB::__construct( array $config = array(), null|\NovemBit\i18n\system\Component &$context = null )
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
array | Configuration array |
$context |
null|\NovemBit\i18n\system\Component | Context (parent) Component |
{@inheritdoc} Init method of component.
DB::commonInit( ): void
Setting default connection of DB
Check if script running on CLI
DB::isCli( ): boolean
DB::getLogger( ): \Psr\Log\LoggerInterface
DB::setLogger( \Psr\Log\LoggerInterface $logger )
Parameters:
Parameter | Type | Description |
---|---|---|
$logger |
\Psr\Log\LoggerInterface |
DB::getRuntimeDir( ): string
DB::setRuntimeDir( string $runtime_dir )
Parameters:
Parameter | Type | Description |
---|---|---|
$runtime_dir |
string |
DB::setCachePool( \Psr\SimpleCache\CacheInterface $cache_pool )
Parameters:
Parameter | Type | Description |
---|---|---|
$cache_pool |
\Psr\SimpleCache\CacheInterface |
DB::getCachePool( ): \Psr\SimpleCache\CacheInterface
DB::defaultConfig( )
- This method is static.
Get connection of DB
DB::getConnection( ): \yii\db\Connection
Set connection of DB
DB::setConnection( \yii\db\Connection $_connection ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$_connection |
\yii\db\Connection | Yii2 db connection |
DB component
Its simple but provides very useful functionality Module class
- Full name: \NovemBit\i18n\component\db\DB
- Parent class: \NovemBit\i18n\system\Component
See Also:
Component constructor.
DB::__construct( array $config = array(), null|\NovemBit\i18n\system\Component &$context = null )
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
array | Configuration array |
$context |
null|\NovemBit\i18n\system\Component | Context (parent) Component |
{@inheritdoc} Init method of component.
DB::commonInit( ): void
Setting default connection of DB
Check if script running on CLI
DB::isCli( ): boolean
DB::getLogger( ): \Psr\Log\LoggerInterface
DB::setLogger( \Psr\Log\LoggerInterface $logger )
Parameters:
Parameter | Type | Description |
---|---|---|
$logger |
\Psr\Log\LoggerInterface |
DB::getRuntimeDir( ): string
DB::setRuntimeDir( string $runtime_dir )
Parameters:
Parameter | Type | Description |
---|---|---|
$runtime_dir |
string |
DB::setCachePool( \Psr\SimpleCache\CacheInterface $cache_pool )
Parameters:
Parameter | Type | Description |
---|---|---|
$cache_pool |
\Psr\SimpleCache\CacheInterface |
DB::getCachePool( ): \Psr\SimpleCache\CacheInterface
DB::defaultConfig( )
- This method is static.
Get connection of DB
DB::getConnection( ): \Doctrine\DBAL\Connection
Connection params getter
DB::getConnectionParams( ): array
Dummy method of translation
- Full name: \NovemBit\i18n\component\translation\method\Dummy
- Parent class: \NovemBit\i18n\component\translation\method\Method
See Also:
System Exception class
- Full name: \NovemBit\i18n\system\exception\Exception
- Parent class:
- This class implements: \NovemBit\i18n\system\exception\FriendlyExceptionInterface
See Also:
Google Translate method of translation
- Full name: \NovemBit\i18n\component\translation\method\Google
- Parent class: \NovemBit\i18n\component\translation\method\Method
See Also:
{@inheritdoc}
Google::mainInit( ): void
ActiveRecord class. Child of Yii ActiveRecord library
- Full name: \NovemBit\i18n\component\translation\type\models\HTML
- Parent class: \NovemBit\i18n\component\translation\models\Translation
See Also:
Main method to get translations from DB
HTML::get( array $texts, string $from_language, array $to_languages, boolean $reverse = false ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$texts |
array | Texts array to translate |
$from_language |
string | From language |
$to_languages |
array | To languages list |
$reverse |
boolean | Use translate column as source (ReTranslate) |
Main method to save translations in DB
HTML::saveTranslations( string $from_language, array $translations, integer $level, boolean $overwrite = false, array &$result = array() ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$from_language |
string | From language |
$translations |
array | Translations of texts |
$level |
integer | Level of translation |
$overwrite |
boolean | Overwrite or not |
$result |
array |
HTML::getDB( ): \Doctrine\DBAL\Connection
- This method is static.
HTML type for translation component
- Full name: \NovemBit\i18n\component\translation\type\HTML
- Parent class: \NovemBit\i18n\component\translation\type\XML
- This class implements: \NovemBit\i18n\component\translation\type\interfaces\HTML
See Also:
{@inheritDoc}
HTML::defaultConfig( ): array
- This method is static.
HTML::getParserType( ): integer
HTML::setParserType( integer $parser_type )
Parameters:
Parameter | Type | Description |
---|---|---|
$parser_type |
integer |
HTML::buildToTranslateFields( \DOMNode &$node, array $params, array &$data )
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
\DOMNode | |
$params |
array | |
$data |
array |
HTML::replaceTranslatedFields( \DOMNode &$node, array $params, array &$data )
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
\DOMNode | |
$params |
array | |
$data |
array |
{@inheritDoc}
HTML::getHelperAttributes( ): boolean
{@inheritDoc}
HTML::setHelperAttributes( boolean $status ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$status |
boolean | If true then |
html translation including additional attributes |
HTML::addBeforeParseCallback( callable $callback )
Parameters:
Parameter | Type | Description |
---|---|---|
$callback |
callable |
HTML::addAfterParseCallback( callable $callback )
Parameters:
Parameter | Type | Description |
---|---|---|
$callback |
callable |
HTML::getBeforeParseCallbacks( ): array
HTML::getAfterParseCallbacks( ): array
HTML type for translation component
- Full name: \NovemBit\i18n\component\translation\type\HTMLFragment
- Parent class: \NovemBit\i18n\component\translation\type\HTML
- This class implements: \NovemBit\i18n\component\translation\type\interfaces\HTMLFragment
See Also:
{@inheritDoc}
HTMLFragment::defaultConfig( ): array
- This method is static.
HTMLFragment::getParserType( ): integer
HTMLFragment::setParserType( integer $parser_type )
Parameters:
Parameter | Type | Description |
---|---|---|
$parser_type |
integer |
HTMLFragment::buildToTranslateFields( \DOMNode &$node, array $params, array &$data )
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
\DOMNode | |
$params |
array | |
$data |
array |
HTMLFragment::replaceTranslatedFields( \DOMNode &$node, array $params, array &$data )
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
\DOMNode | |
$params |
array | |
$data |
array |
{@inheritDoc}
HTMLFragment::getHelperAttributes( ): boolean
{@inheritDoc}
HTMLFragment::setHelperAttributes( boolean $status ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$status |
boolean | If true then |
html translation including additional attributes |
HTMLFragment::addBeforeParseCallback( callable $callback )
Parameters:
Parameter | Type | Description |
---|---|---|
$callback |
callable |
HTMLFragment::addAfterParseCallback( callable $callback )
Parameters:
Parameter | Type | Description |
---|---|---|
$callback |
callable |
HTMLFragment::getBeforeParseCallbacks( ): array
HTMLFragment::getAfterParseCallbacks( ): array
ActiveRecord class. Child of Yii ActiveRecord library
- Full name: \NovemBit\i18n\component\translation\type\models\JSON
- Parent class: \NovemBit\i18n\component\translation\models\Translation
See Also:
Main method to get translations from DB
JSON::get( array $texts, string $from_language, array $to_languages, boolean $reverse = false ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$texts |
array | Texts array to translate |
$from_language |
string | From language |
$to_languages |
array | To languages list |
$reverse |
boolean | Use translate column as source (ReTranslate) |
Main method to save translations in DB
JSON::saveTranslations( string $from_language, array $translations, integer $level, boolean $overwrite = false, array &$result = array() ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$from_language |
string | From language |
$translations |
array | Translations of texts |
$level |
integer | Level of translation |
$overwrite |
boolean | Overwrite or not |
$result |
array |
JSON::getDB( ): \Doctrine\DBAL\Connection
- This method is static.
Language Component Exception file
- Full name: \NovemBit\i18n\component\languages\exceptions\LanguageException
- Parent class: \NovemBit\i18n\system\exception\Exception
See Also:
ActiveRecord class. Child of Yii ActiveRecord library
- Full name: \NovemBit\i18n\component\translation\method\models\Method
- Parent class: \NovemBit\i18n\component\translation\models\Translation
See Also:
Main method to get translations from DB
Method::get( array $texts, string $from_language, array $to_languages, boolean $reverse = false ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$texts |
array | Texts array to translate |
$from_language |
string | From language |
$to_languages |
array | To languages list |
$reverse |
boolean | Use translate column as source (ReTranslate) |
Main method to save translations in DB
Method::saveTranslations( string $from_language, array $translations, integer $level, boolean $overwrite = false, array &$result = array() ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$from_language |
string | From language |
$translations |
array | Translations of texts |
$level |
integer | Level of translation |
$overwrite |
boolean | Overwrite or not |
$result |
array |
Method::getDB( ): \Doctrine\DBAL\Connection
- This method is static.
Language Component Exception file
- Full name: \NovemBit\i18n\component\translation\method\exceptions\MethodException
- Parent class: \NovemBit\i18n\system\exception\Exception
See Also:
Module class Main instance of i18n library. Should be used for any external connection Provides component system. There have some required components, DBAL (RDMS) configurations, Request handlers, Translation abstraction layer,
Its simple but provides very useful functionality Module class
- Full name: \NovemBit\i18n\Module
- Parent class: \NovemBit\i18n\system\Component
See Also:
Component constructor.
Module::__construct( array $config = array(), null|\NovemBit\i18n\system\Component &$context = null )
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
array | Configuration array |
$context |
null|\NovemBit\i18n\system\Component | Context (parent) Component |
Module::commonLateInit( ): void
Load Yii framework container to use some libraries that not Allowed to use standalone
Component init method Non CLI Running after child component initialization
Module::mainInit( ): void
Check if script running on CLI
Module::isCli( ): boolean
Module::getLogger( ): \Psr\Log\LoggerInterface
Module::setLogger( \Psr\Log\LoggerInterface $logger )
Parameters:
Parameter | Type | Description |
---|---|---|
$logger |
\Psr\Log\LoggerInterface |
Module::getRuntimeDir( ): string
Module::setRuntimeDir( string $runtime_dir )
Parameters:
Parameter | Type | Description |
---|---|---|
$runtime_dir |
string |
Module::setCachePool( \Psr\SimpleCache\CacheInterface $cache_pool )
Parameters:
Parameter | Type | Description |
---|---|---|
$cache_pool |
\Psr\SimpleCache\CacheInterface |
Module::getCachePool( ): \Psr\SimpleCache\CacheInterface
Default component configuration
Module::defaultConfig( ): array
- This method is static.
Start request translation
Module::start( ): void
Creating module main instance
Module::instance( null|array $config = null ): self
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$config |
null|array | Main configuration array |
Request Exception class
- Full name: \NovemBit\i18n\component\request\exceptions\RequestException
- Parent class: \NovemBit\i18n\system\exception\Exception
See Also:
Rest component
Its simple but provides very useful functionality Module class
- Full name: \NovemBit\i18n\component\rest\Rest
- Parent class: \NovemBit\i18n\system\Component
- This class implements: \NovemBit\i18n\component\rest\interfaces\Rest
See Also:
Component constructor.
Rest::__construct( array $config = array(), null|\NovemBit\i18n\system\Component &$context = null )
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
array | Configuration array |
$context |
null|\NovemBit\i18n\system\Component | Context (parent) Component |
Check if script running on CLI
Rest::isCli( ): boolean
Rest::getLogger( ): \Psr\Log\LoggerInterface
Rest::setLogger( \Psr\Log\LoggerInterface $logger )
Parameters:
Parameter | Type | Description |
---|---|---|
$logger |
\Psr\Log\LoggerInterface |
Rest::getRuntimeDir( ): string
Rest::setRuntimeDir( string $runtime_dir )
Parameters:
Parameter | Type | Description |
---|---|---|
$runtime_dir |
string |
Rest::setCachePool( \Psr\SimpleCache\CacheInterface $cache_pool )
Parameters:
Parameter | Type | Description |
---|---|---|
$cache_pool |
\Psr\SimpleCache\CacheInterface |
Rest::getCachePool( ): \Psr\SimpleCache\CacheInterface
Rest::defaultConfig( )
- This method is static.
Start rest request
Rest::start( ): void
Translate Action method
Rest::actionTranslate( ): array|integer
Index Action method
Rest::actionIndex( ): array
Restrict Action method
Rest::actionRestrict( ): array
Rest Translate method of translation
- Full name: \NovemBit\i18n\component\translation\method\Rest
- Parent class: \NovemBit\i18n\component\translation\method\Method
See Also:
Get languages configuration from main module instance $config
Rest::getLanguagesConfig( ): array
- Full name: \NovemBit\i18n\system\helpers\Strings
Get string difference
Strings::getStringsDifference( string $before, string $after, string|null &$prefix = null, string|null &$suffix = null ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$before |
string | Initial type of string |
$after |
string | Final type of string |
$prefix |
string|null | Referenced variable to receive difference prefix |
$suffix |
string|null | Referenced variable to receive difference suffix |
ActiveRecord class. Child of Yii ActiveRecord library
- Full name: \NovemBit\i18n\component\translation\type\models\Text
- Parent class: \NovemBit\i18n\component\translation\models\Translation
See Also:
Main method to get translations from DB
Text::get( array $texts, string $from_language, array $to_languages, boolean $reverse = false ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$texts |
array | Texts array to translate |
$from_language |
string | From language |
$to_languages |
array | To languages list |
$reverse |
boolean | Use translate column as source (ReTranslate) |
Main method to save translations in DB
Text::saveTranslations( string $from_language, array $translations, integer $level, boolean $overwrite = false, array &$result = array() ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$from_language |
string | From language |
$translations |
array | Translations of texts |
$level |
integer | Level of translation |
$overwrite |
boolean | Overwrite or not |
$result |
array |
Text::getDB( ): \Doctrine\DBAL\Connection
- This method is static.
ActiveRecord class. Child of Yii ActiveRecord library
- Full name: \NovemBit\i18n\component\translation\models\Translation
- Parent class: \NovemBit\i18n\models\DataMapper
- This class implements: \NovemBit\i18n\component\translation\models\interfaces\Translation
See Also:
Translation::getDB( ): \Doctrine\DBAL\Connection
- This method is static.
Main method to get translations from DB
Translation::get( array $texts, string $from_language, array $to_languages, boolean $reverse = false ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$texts |
array | Texts array to translate |
$from_language |
string | From language |
$to_languages |
array | To languages list |
$reverse |
boolean | Use translate column as source (ReTranslate) |
Main method to save translations in DB
Translation::saveTranslations( string $from_language, array $translations, integer $level, boolean $overwrite = false, array &$result = array() ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$from_language |
string | From language |
$translations |
array | Translations of texts |
$level |
integer | Level of translation |
$overwrite |
boolean | Overwrite or not |
$result |
array |
Request Exception class
- Full name: \NovemBit\i18n\component\translation\exceptions\TranslationException
- Parent class: \NovemBit\i18n\system\exception\Exception
See Also:
ActiveRecord class. Child of Yii ActiveRecord library
- Full name: \NovemBit\i18n\component\translation\type\models\URL
- Parent class: \NovemBit\i18n\component\translation\models\Translation
See Also:
Main method to get translations from DB
URL::get( array $texts, string $from_language, array $to_languages, boolean $reverse = false ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$texts |
array | Texts array to translate |
$from_language |
string | From language |
$to_languages |
array | To languages list |
$reverse |
boolean | Use translate column as source (ReTranslate) |
Main method to save translations in DB
URL::saveTranslations( string $from_language, array $translations, integer $level, boolean $overwrite = false, array &$result = array() ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$from_language |
string | From language |
$translations |
array | Translations of texts |
$level |
integer | Level of translation |
$overwrite |
boolean | Overwrite or not |
$result |
array |
URL::getDB( ): \Doctrine\DBAL\Connection
- This method is static.
{@inheritdoc}
URL::rules( ): array
Helper class for some actions with URLs
- Full name: \NovemBit\i18n\system\helpers\URL
See Also:
Adding query parameters to URL
URL::addQueryVars( string $url, string $name, string $value ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$url |
string | Initial url |
$name |
string | Parameter name (key) |
$value |
string | Value of parameter |
Remove Query parameter from URL
URL::removeQueryVars( string $url, string $paramName ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$url |
string | Initial url |
$paramName |
string | Parameter name (key) |
Build url from parts Same as reversed parse_url
URL::buildUrl( array $parts ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$parts |
array | Parts of url |
HTML type for translation component
- Full name: \NovemBit\i18n\component\translation\type\XML
- Parent class: \NovemBit\i18n\component\translation\type\Type
See Also:
{@inheritDoc}
XML::defaultConfig( ): array
- This method is static.
XML::getParserType( ): integer
XML::setParserType( integer $parser_type )
Parameters:
Parameter | Type | Description |
---|---|---|
$parser_type |
integer |
XML::buildToTranslateFields( \DOMNode &$node, array $params, array &$data )
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
\DOMNode | |
$params |
array | |
$data |
array |
XML::replaceTranslatedFields( \DOMNode &$node, array $params, array &$data )
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
\DOMNode | |
$params |
array | |
$data |
array |
{@inheritDoc}
XML::getHelperAttributes( ): boolean
{@inheritDoc}
XML::setHelperAttributes( boolean $status ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$status |
boolean | If true then |
html translation including additional attributes |
XML::addBeforeParseCallback( callable $callback )
Parameters:
Parameter | Type | Description |
---|---|---|
$callback |
callable |
XML::addAfterParseCallback( callable $callback )
Parameters:
Parameter | Type | Description |
---|---|---|
$callback |
callable |
XML::getBeforeParseCallbacks( ): array
XML::getAfterParseCallbacks( ): array
ActiveRecord class. Child of Yii ActiveRecord library
- Full name: \NovemBit\i18n\component\translation\type\models\XML
- Parent class: \NovemBit\i18n\component\translation\models\Translation
See Also:
Main method to get translations from DB
XML::get( array $texts, string $from_language, array $to_languages, boolean $reverse = false ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$texts |
array | Texts array to translate |
$from_language |
string | From language |
$to_languages |
array | To languages list |
$reverse |
boolean | Use translate column as source (ReTranslate) |
Main method to save translations in DB
XML::saveTranslations( string $from_language, array $translations, integer $level, boolean $overwrite = false, array &$result = array() ): void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$from_language |
string | From language |
$translations |
array | Translations of texts |
$level |
integer | Level of translation |
$overwrite |
boolean | Overwrite or not |
$result |
array |
XML::getDB( ): \Doctrine\DBAL\Connection
- This method is static.
This document was automatically generated from source code comments on 2019-12-03 using phpDocumentor and cvuorinen/phpdoc-markdown-public