PHPackages                             novembit/i18n - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. novembit/i18n

ActiveLibrary[Localization &amp; i18n](/categories/localization)

novembit/i18n
=============

Standalone i18n.

1.0.5(6y ago)3535GPL-3.0-or-laterPHPPHP &gt;=7.1

Since Sep 11Pushed 4y ago2 watchersCompare

[ Source](https://github.com/NovemBit/i18n)[ Packagist](https://packagist.org/packages/novembit/i18n)[ RSS](/packages/novembit-i18n/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (10)Versions (11)Used By (0)

NovemBit i18n - Internationalization framework library
======================================================

[](#novembit-i18n---internationalization-framework-library)

Table of Contents
-----------------

[](#table-of-contents)

- [Arrays](#arrays)
    - [arrayWalkWithRoute](#arraywalkwithroute)
    - [arrayMergeRecursiveDistinct](#arraymergerecursivedistinct)
- [DataMapper](#datamapper)
    - [getDB](#getdb)
- [DB](#db)
    - [\_\_construct](#__construct)
    - [commonInit](#commoninit)
    - [isCli](#iscli)
    - [getLogger](#getlogger)
    - [setLogger](#setlogger)
    - [getRuntimeDir](#getruntimedir)
    - [setRuntimeDir](#setruntimedir)
    - [setCachePool](#setcachepool)
    - [getCachePool](#getcachepool)
    - [defaultConfig](#defaultconfig)
    - [getConnection](#getconnection)
    - [setConnection](#setconnection)
- [DB](#db-1)
    - [\_\_construct](#__construct-1)
    - [commonInit](#commoninit-1)
    - [isCli](#iscli-1)
    - [getLogger](#getlogger-1)
    - [setLogger](#setlogger-1)
    - [getRuntimeDir](#getruntimedir-1)
    - [setRuntimeDir](#setruntimedir-1)
    - [setCachePool](#setcachepool-1)
    - [getCachePool](#getcachepool-1)
    - [defaultConfig](#defaultconfig-1)
    - [getConnection](#getconnection-1)
    - [getConnectionParams](#getconnectionparams)
- [Dummy](#dummy)
- [Exception](#exception)
- [Google](#google)
    - [mainInit](#maininit)
- [HTML](#html)
    - [get](#get)
    - [saveTranslations](#savetranslations)
    - [getDB](#getdb-1)
- [HTML](#html-1)
    - [defaultConfig](#defaultconfig-2)
    - [getParserType](#getparsertype)
    - [setParserType](#setparsertype)
    - [buildToTranslateFields](#buildtotranslatefields)
    - [replaceTranslatedFields](#replacetranslatedfields)
    - [getHelperAttributes](#gethelperattributes)
    - [setHelperAttributes](#sethelperattributes)
    - [addBeforeParseCallback](#addbeforeparsecallback)
    - [addAfterParseCallback](#addafterparsecallback)
    - [getBeforeParseCallbacks](#getbeforeparsecallbacks)
    - [getAfterParseCallbacks](#getafterparsecallbacks)
- [HTMLFragment](#htmlfragment)
    - [defaultConfig](#defaultconfig-3)
    - [getParserType](#getparsertype-1)
    - [setParserType](#setparsertype-1)
    - [buildToTranslateFields](#buildtotranslatefields-1)
    - [replaceTranslatedFields](#replacetranslatedfields-1)
    - [getHelperAttributes](#gethelperattributes-1)
    - [setHelperAttributes](#sethelperattributes-1)
    - [addBeforeParseCallback](#addbeforeparsecallback-1)
    - [addAfterParseCallback](#addafterparsecallback-1)
    - [getBeforeParseCallbacks](#getbeforeparsecallbacks-1)
    - [getAfterParseCallbacks](#getafterparsecallbacks-1)
- [JSON](#json)
    - [get](#get-1)
    - [saveTranslations](#savetranslations-1)
    - [getDB](#getdb-2)
- [LanguageException](#languageexception)
- [Method](#method)
    - [get](#get-2)
    - [saveTranslations](#savetranslations-2)
    - [getDB](#getdb-3)
- [MethodException](#methodexception)
- [Module](#module)
    - [\_\_construct](#__construct-2)
    - [commonLateInit](#commonlateinit)
    - [mainInit](#maininit-1)
    - [isCli](#iscli-2)
    - [getLogger](#getlogger-2)
    - [setLogger](#setlogger-2)
    - [getRuntimeDir](#getruntimedir-2)
    - [setRuntimeDir](#setruntimedir-2)
    - [setCachePool](#setcachepool-2)
    - [getCachePool](#getcachepool-2)
    - [defaultConfig](#defaultconfig-4)
    - [start](#start)
    - [instance](#instance)
- [RequestException](#requestexception)
- [Rest](#rest)
    - [\_\_construct](#__construct-3)
    - [isCli](#iscli-3)
    - [getLogger](#getlogger-3)
    - [setLogger](#setlogger-3)
    - [getRuntimeDir](#getruntimedir-3)
    - [setRuntimeDir](#setruntimedir-3)
    - [setCachePool](#setcachepool-3)
    - [getCachePool](#getcachepool-3)
    - [defaultConfig](#defaultconfig-5)
    - [start](#start-1)
    - [actionTranslate](#actiontranslate)
    - [actionIndex](#actionindex)
    - [actionRestrict](#actionrestrict)
- [Rest](#rest-1)
    - [getLanguagesConfig](#getlanguagesconfig)
- [Strings](#strings)
    - [getStringsDifference](#getstringsdifference)
- [Text](#text)
    - [get](#get-3)
    - [saveTranslations](#savetranslations-3)
    - [getDB](#getdb-4)
- [Translation](#translation)
    - [getDB](#getdb-5)
    - [get](#get-4)
    - [saveTranslations](#savetranslations-4)
- [TranslationException](#translationexception)
- [URL](#url)
    - [get](#get-5)
    - [saveTranslations](#savetranslations-5)
    - [getDB](#getdb-6)
    - [rules](#rules)
- [URL](#url-1)
    - [addQueryVars](#addqueryvars)
    - [removeQueryVars](#removequeryvars)
    - [buildUrl](#buildurl)
- [XML](#xml)
    - [defaultConfig](#defaultconfig-6)
    - [getParserType](#getparsertype-2)
    - [setParserType](#setparsertype-2)
    - [buildToTranslateFields](#buildtotranslatefields-2)
    - [replaceTranslatedFields](#replacetranslatedfields-2)
    - [getHelperAttributes](#gethelperattributes-2)
    - [setHelperAttributes](#sethelperattributes-2)
    - [addBeforeParseCallback](#addbeforeparsecallback-2)
    - [addAfterParseCallback](#addafterparsecallback-2)
    - [getBeforeParseCallbacks](#getbeforeparsecallbacks-2)
    - [getAfterParseCallbacks](#getafterparsecallbacks-2)
- [XML](#xml-1)
    - [get](#get-6)
    - [saveTranslations](#savetranslations-6)
    - [getDB](#getdb-7)

Arrays
------

[](#arrays)

- Full name: \\NovemBit\\i18n\\system\\helpers\\Arrays

### arrayWalkWithRoute

[](#arraywalkwithroute)

Recursive array walk with callback and route

```
Arrays::arrayWalkWithRoute( array &$arr, callable $callback, \NovemBit\i18n\system\helpers\Strings $route = &#039;&#039;, \NovemBit\i18n\system\helpers\Strings $separator = &#039;&gt;&#039; ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$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---

### arrayMergeRecursiveDistinct

[](#arraymergerecursivedistinct)

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' =&gt; 'org value'), array('key' =&gt; 'new value')); =&gt; array('key' =&gt; 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' =&gt; 'org value'), array('key' =&gt; 'new value')); =&gt; array('key' =&gt; 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:**

ParameterTypeDescription`$array1`**array**`$array2`**array**---

DataMapper
----------

[](#datamapper)

ActiveRecord class. Child of Yii ActiveRecord library

- Full name: \\NovemBit\\i18n\\models\\DataMapper

**See Also:**

-

### getDB

[](#getdb)

```
DataMapper::getDB(  ): \Doctrine\DBAL\Connection
```

- This method is **static**.

---

DB
--

[](#db)

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:**

-

### \_\_construct

[](#__construct)

Component constructor.

```
DB::__construct( array $config = array(), null|\NovemBit\i18n\system\Component &$context = null )
```

**Parameters:**

ParameterTypeDescription`$config`**array**Configuration array`$context`**null|\\NovemBit\\i18n\\system\\Component**Context (parent) Component---

### commonInit

[](#commoninit)

{@inheritdoc} Init method of component.

```
DB::commonInit(  ): void
```

Setting default connection of DB

---

### isCli

[](#iscli)

Check if script running on CLI

```
DB::isCli(  ): boolean
```

---

### getLogger

[](#getlogger)

```
DB::getLogger(  ): \Psr\Log\LoggerInterface
```

---

### setLogger

[](#setlogger)

```
DB::setLogger( \Psr\Log\LoggerInterface $logger )
```

**Parameters:**

ParameterTypeDescription`$logger`**\\Psr\\Log\\LoggerInterface**---

### getRuntimeDir

[](#getruntimedir)

```
DB::getRuntimeDir(  ): string
```

---

### setRuntimeDir

[](#setruntimedir)

```
DB::setRuntimeDir( string $runtime_dir )
```

**Parameters:**

ParameterTypeDescription`$runtime_dir`**string**---

### setCachePool

[](#setcachepool)

```
DB::setCachePool( \Psr\SimpleCache\CacheInterface $cache_pool )
```

**Parameters:**

ParameterTypeDescription`$cache_pool`**\\Psr\\SimpleCache\\CacheInterface**---

### getCachePool

[](#getcachepool)

```
DB::getCachePool(  ): \Psr\SimpleCache\CacheInterface
```

---

### defaultConfig

[](#defaultconfig)

```
DB::defaultConfig(  )
```

- This method is **static**.

---

### getConnection

[](#getconnection)

Get connection of DB

```
DB::getConnection(  ): \yii\db\Connection
```

---

### setConnection

[](#setconnection)

Set connection of DB

```
DB::setConnection( \yii\db\Connection $_connection ): void
```

**Parameters:**

ParameterTypeDescription`$_connection`**\\yii\\db\\Connection**Yii2 db connection---

DB
--

[](#db-1)

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:**

-

### \_\_construct

[](#__construct-1)

Component constructor.

```
DB::__construct( array $config = array(), null|\NovemBit\i18n\system\Component &$context = null )
```

**Parameters:**

ParameterTypeDescription`$config`**array**Configuration array`$context`**null|\\NovemBit\\i18n\\system\\Component**Context (parent) Component---

### commonInit

[](#commoninit-1)

{@inheritdoc} Init method of component.

```
DB::commonInit(  ): void
```

Setting default connection of DB

---

### isCli

[](#iscli-1)

Check if script running on CLI

```
DB::isCli(  ): boolean
```

---

### getLogger

[](#getlogger-1)

```
DB::getLogger(  ): \Psr\Log\LoggerInterface
```

---

### setLogger

[](#setlogger-1)

```
DB::setLogger( \Psr\Log\LoggerInterface $logger )
```

**Parameters:**

ParameterTypeDescription`$logger`**\\Psr\\Log\\LoggerInterface**---

### getRuntimeDir

[](#getruntimedir-1)

```
DB::getRuntimeDir(  ): string
```

---

### setRuntimeDir

[](#setruntimedir-1)

```
DB::setRuntimeDir( string $runtime_dir )
```

**Parameters:**

ParameterTypeDescription`$runtime_dir`**string**---

### setCachePool

[](#setcachepool-1)

```
DB::setCachePool( \Psr\SimpleCache\CacheInterface $cache_pool )
```

**Parameters:**

ParameterTypeDescription`$cache_pool`**\\Psr\\SimpleCache\\CacheInterface**---

### getCachePool

[](#getcachepool-1)

```
DB::getCachePool(  ): \Psr\SimpleCache\CacheInterface
```

---

### defaultConfig

[](#defaultconfig-1)

```
DB::defaultConfig(  )
```

- This method is **static**.

---

### getConnection

[](#getconnection-1)

Get connection of DB

```
DB::getConnection(  ): \Doctrine\DBAL\Connection
```

---

### getConnectionParams

[](#getconnectionparams)

Connection params getter

```
DB::getConnectionParams(  ): array
```

---

Dummy
-----

[](#dummy)

Dummy method of translation

- Full name: \\NovemBit\\i18n\\component\\translation\\method\\Dummy
- Parent class: \\NovemBit\\i18n\\component\\translation\\method\\Method

**See Also:**

-

Exception
---------

[](#exception)

System Exception class

- Full name: \\NovemBit\\i18n\\system\\exception\\Exception
- Parent class:
- This class implements: \\NovemBit\\i18n\\system\\exception\\FriendlyExceptionInterface

**See Also:**

-

Google
------

[](#google)

Google Translate method of translation

- Full name: \\NovemBit\\i18n\\component\\translation\\method\\Google
- Parent class: \\NovemBit\\i18n\\component\\translation\\method\\Method

**See Also:**

-

### mainInit

[](#maininit)

{@inheritdoc}

```
Google::mainInit(  ): void
```

---

HTML
----

[](#html)

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:**

-

### get

[](#get)

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:**

ParameterTypeDescription`$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)---

### saveTranslations

[](#savetranslations)

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:**

ParameterTypeDescription`$from_language`**string**From language`$translations`**array**Translations of texts`$level`**integer**Level of translation`$overwrite`**boolean**Overwrite or not`$result`**array**---

### getDB

[](#getdb-1)

```
HTML::getDB(  ): \Doctrine\DBAL\Connection
```

- This method is **static**.

---

HTML
----

[](#html-1)

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:**

-

### defaultConfig

[](#defaultconfig-2)

{@inheritDoc}

```
HTML::defaultConfig(  ): array
```

- This method is **static**.

---

### getParserType

[](#getparsertype)

```
HTML::getParserType(  ): integer
```

---

### setParserType

[](#setparsertype)

```
HTML::setParserType( integer $parser_type )
```

**Parameters:**

ParameterTypeDescription`$parser_type`**integer**---

### buildToTranslateFields

[](#buildtotranslatefields)

```
HTML::buildToTranslateFields( \DOMNode &$node, array $params, array &$data )
```

**Parameters:**

ParameterTypeDescription`$node`**\\DOMNode**`$params`**array**`$data`**array**---

### replaceTranslatedFields

[](#replacetranslatedfields)

```
HTML::replaceTranslatedFields( \DOMNode &$node, array $params, array &$data )
```

**Parameters:**

ParameterTypeDescription`$node`**\\DOMNode**`$params`**array**`$data`**array**---

### getHelperAttributes

[](#gethelperattributes)

{@inheritDoc}

```
HTML::getHelperAttributes(  ): boolean
```

---

### setHelperAttributes

[](#sethelperattributes)

{@inheritDoc}

```
HTML::setHelperAttributes( boolean $status ): void
```

**Parameters:**

ParameterTypeDescription`$status`**boolean**If true then```
                html translation including additional attributes |

```

---

### addBeforeParseCallback

[](#addbeforeparsecallback)

```
HTML::addBeforeParseCallback( callable $callback )
```

**Parameters:**

ParameterTypeDescription`$callback`**callable**---

### addAfterParseCallback

[](#addafterparsecallback)

```
HTML::addAfterParseCallback( callable $callback )
```

**Parameters:**

ParameterTypeDescription`$callback`**callable**---

### getBeforeParseCallbacks

[](#getbeforeparsecallbacks)

```
HTML::getBeforeParseCallbacks(  ): array
```

---

### getAfterParseCallbacks

[](#getafterparsecallbacks)

```
HTML::getAfterParseCallbacks(  ): array
```

---

HTMLFragment
------------

[](#htmlfragment)

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:**

-

### defaultConfig

[](#defaultconfig-3)

{@inheritDoc}

```
HTMLFragment::defaultConfig(  ): array
```

- This method is **static**.

---

### getParserType

[](#getparsertype-1)

```
HTMLFragment::getParserType(  ): integer
```

---

### setParserType

[](#setparsertype-1)

```
HTMLFragment::setParserType( integer $parser_type )
```

**Parameters:**

ParameterTypeDescription`$parser_type`**integer**---

### buildToTranslateFields

[](#buildtotranslatefields-1)

```
HTMLFragment::buildToTranslateFields( \DOMNode &$node, array $params, array &$data )
```

**Parameters:**

ParameterTypeDescription`$node`**\\DOMNode**`$params`**array**`$data`**array**---

### replaceTranslatedFields

[](#replacetranslatedfields-1)

```
HTMLFragment::replaceTranslatedFields( \DOMNode &$node, array $params, array &$data )
```

**Parameters:**

ParameterTypeDescription`$node`**\\DOMNode**`$params`**array**`$data`**array**---

### getHelperAttributes

[](#gethelperattributes-1)

{@inheritDoc}

```
HTMLFragment::getHelperAttributes(  ): boolean
```

---

### setHelperAttributes

[](#sethelperattributes-1)

{@inheritDoc}

```
HTMLFragment::setHelperAttributes( boolean $status ): void
```

**Parameters:**

ParameterTypeDescription`$status`**boolean**If true then```
                html translation including additional attributes |

```

---

### addBeforeParseCallback

[](#addbeforeparsecallback-1)

```
HTMLFragment::addBeforeParseCallback( callable $callback )
```

**Parameters:**

ParameterTypeDescription`$callback`**callable**---

### addAfterParseCallback

[](#addafterparsecallback-1)

```
HTMLFragment::addAfterParseCallback( callable $callback )
```

**Parameters:**

ParameterTypeDescription`$callback`**callable**---

### getBeforeParseCallbacks

[](#getbeforeparsecallbacks-1)

```
HTMLFragment::getBeforeParseCallbacks(  ): array
```

---

### getAfterParseCallbacks

[](#getafterparsecallbacks-1)

```
HTMLFragment::getAfterParseCallbacks(  ): array
```

---

JSON
----

[](#json)

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:**

-

### get

[](#get-1)

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:**

ParameterTypeDescription`$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)---

### saveTranslations

[](#savetranslations-1)

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:**

ParameterTypeDescription`$from_language`**string**From language`$translations`**array**Translations of texts`$level`**integer**Level of translation`$overwrite`**boolean**Overwrite or not`$result`**array**---

### getDB

[](#getdb-2)

```
JSON::getDB(  ): \Doctrine\DBAL\Connection
```

- This method is **static**.

---

LanguageException
-----------------

[](#languageexception)

Language Component Exception file

- Full name: \\NovemBit\\i18n\\component\\languages\\exceptions\\LanguageException
- Parent class: \\NovemBit\\i18n\\system\\exception\\Exception

**See Also:**

-

Method
------

[](#method)

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:**

-

### get

[](#get-2)

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:**

ParameterTypeDescription`$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)---

### saveTranslations

[](#savetranslations-2)

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:**

ParameterTypeDescription`$from_language`**string**From language`$translations`**array**Translations of texts`$level`**integer**Level of translation`$overwrite`**boolean**Overwrite or not`$result`**array**---

### getDB

[](#getdb-3)

```
Method::getDB(  ): \Doctrine\DBAL\Connection
```

- This method is **static**.

---

MethodException
---------------

[](#methodexception)

Language Component Exception file

- Full name: \\NovemBit\\i18n\\component\\translation\\method\\exceptions\\MethodException
- Parent class: \\NovemBit\\i18n\\system\\exception\\Exception

**See Also:**

-

Module
------

[](#module)

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:**

-

### \_\_construct

[](#__construct-2)

Component constructor.

```
Module::__construct( array $config = array(), null|\NovemBit\i18n\system\Component &$context = null )
```

**Parameters:**

ParameterTypeDescription`$config`**array**Configuration array`$context`**null|\\NovemBit\\i18n\\system\\Component**Context (parent) Component---

### commonLateInit

[](#commonlateinit)

```
Module::commonLateInit(  ): void
```

Load Yii framework container to use some libraries that not Allowed to use standalone

---

### mainInit

[](#maininit-1)

Component init method Non CLI Running after child component initialization

```
Module::mainInit(  ): void
```

---

### isCli

[](#iscli-2)

Check if script running on CLI

```
Module::isCli(  ): boolean
```

---

### getLogger

[](#getlogger-2)

```
Module::getLogger(  ): \Psr\Log\LoggerInterface
```

---

### setLogger

[](#setlogger-2)

```
Module::setLogger( \Psr\Log\LoggerInterface $logger )
```

**Parameters:**

ParameterTypeDescription`$logger`**\\Psr\\Log\\LoggerInterface**---

### getRuntimeDir

[](#getruntimedir-2)

```
Module::getRuntimeDir(  ): string
```

---

### setRuntimeDir

[](#setruntimedir-2)

```
Module::setRuntimeDir( string $runtime_dir )
```

**Parameters:**

ParameterTypeDescription`$runtime_dir`**string**---

### setCachePool

[](#setcachepool-2)

```
Module::setCachePool( \Psr\SimpleCache\CacheInterface $cache_pool )
```

**Parameters:**

ParameterTypeDescription`$cache_pool`**\\Psr\\SimpleCache\\CacheInterface**---

### getCachePool

[](#getcachepool-2)

```
Module::getCachePool(  ): \Psr\SimpleCache\CacheInterface
```

---

### defaultConfig

[](#defaultconfig-4)

Default component configuration

```
Module::defaultConfig(  ): array
```

- This method is **static**.

---

### start

[](#start)

Start request translation

```
Module::start(  ): void
```

---

### instance

[](#instance)

Creating module main instance

```
Module::instance( null|array $config = null ): self
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$config`**null|array**Main configuration array---

RequestException
----------------

[](#requestexception)

Request Exception class

- Full name: \\NovemBit\\i18n\\component\\request\\exceptions\\RequestException
- Parent class: \\NovemBit\\i18n\\system\\exception\\Exception

**See Also:**

-

Rest
----

[](#rest)

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:**

-

### \_\_construct

[](#__construct-3)

Component constructor.

```
Rest::__construct( array $config = array(), null|\NovemBit\i18n\system\Component &$context = null )
```

**Parameters:**

ParameterTypeDescription`$config`**array**Configuration array`$context`**null|\\NovemBit\\i18n\\system\\Component**Context (parent) Component---

### isCli

[](#iscli-3)

Check if script running on CLI

```
Rest::isCli(  ): boolean
```

---

### getLogger

[](#getlogger-3)

```
Rest::getLogger(  ): \Psr\Log\LoggerInterface
```

---

### setLogger

[](#setlogger-3)

```
Rest::setLogger( \Psr\Log\LoggerInterface $logger )
```

**Parameters:**

ParameterTypeDescription`$logger`**\\Psr\\Log\\LoggerInterface**---

### getRuntimeDir

[](#getruntimedir-3)

```
Rest::getRuntimeDir(  ): string
```

---

### setRuntimeDir

[](#setruntimedir-3)

```
Rest::setRuntimeDir( string $runtime_dir )
```

**Parameters:**

ParameterTypeDescription`$runtime_dir`**string**---

### setCachePool

[](#setcachepool-3)

```
Rest::setCachePool( \Psr\SimpleCache\CacheInterface $cache_pool )
```

**Parameters:**

ParameterTypeDescription`$cache_pool`**\\Psr\\SimpleCache\\CacheInterface**---

### getCachePool

[](#getcachepool-3)

```
Rest::getCachePool(  ): \Psr\SimpleCache\CacheInterface
```

---

### defaultConfig

[](#defaultconfig-5)

```
Rest::defaultConfig(  )
```

- This method is **static**.

---

### start

[](#start-1)

Start rest request

```
Rest::start(  ): void
```

---

### actionTranslate

[](#actiontranslate)

Translate Action method

```
Rest::actionTranslate(  ): array|integer
```

---

### actionIndex

[](#actionindex)

Index Action method

```
Rest::actionIndex(  ): array
```

---

### actionRestrict

[](#actionrestrict)

Restrict Action method

```
Rest::actionRestrict(  ): array
```

---

Rest
----

[](#rest-1)

Rest Translate method of translation

- Full name: \\NovemBit\\i18n\\component\\translation\\method\\Rest
- Parent class: \\NovemBit\\i18n\\component\\translation\\method\\Method

**See Also:**

-

### getLanguagesConfig

[](#getlanguagesconfig)

Get languages configuration from main module instance `$config`

```
Rest::getLanguagesConfig(  ): array
```

---

Strings
-------

[](#strings)

- Full name: \\NovemBit\\i18n\\system\\helpers\\Strings

### getStringsDifference

[](#getstringsdifference)

Get string difference

```
Strings::getStringsDifference( string $before, string $after, string|null &$prefix = null, string|null &$suffix = null ): void
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$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---

Text
----

[](#text)

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:**

-

### get

[](#get-3)

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:**

ParameterTypeDescription`$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)---

### saveTranslations

[](#savetranslations-3)

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:**

ParameterTypeDescription`$from_language`**string**From language`$translations`**array**Translations of texts`$level`**integer**Level of translation`$overwrite`**boolean**Overwrite or not`$result`**array**---

### getDB

[](#getdb-4)

```
Text::getDB(  ): \Doctrine\DBAL\Connection
```

- This method is **static**.

---

Translation
-----------

[](#translation)

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:**

-

### getDB

[](#getdb-5)

```
Translation::getDB(  ): \Doctrine\DBAL\Connection
```

- This method is **static**.

---

### get

[](#get-4)

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:**

ParameterTypeDescription`$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)---

### saveTranslations

[](#savetranslations-4)

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:**

ParameterTypeDescription`$from_language`**string**From language`$translations`**array**Translations of texts`$level`**integer**Level of translation`$overwrite`**boolean**Overwrite or not`$result`**array**---

TranslationException
--------------------

[](#translationexception)

Request Exception class

- Full name: \\NovemBit\\i18n\\component\\translation\\exceptions\\TranslationException
- Parent class: \\NovemBit\\i18n\\system\\exception\\Exception

**See Also:**

-

URL
---

[](#url)

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:**

-

### get

[](#get-5)

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:**

ParameterTypeDescription`$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)---

### saveTranslations

[](#savetranslations-5)

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:**

ParameterTypeDescription`$from_language`**string**From language`$translations`**array**Translations of texts`$level`**integer**Level of translation`$overwrite`**boolean**Overwrite or not`$result`**array**---

### getDB

[](#getdb-6)

```
URL::getDB(  ): \Doctrine\DBAL\Connection
```

- This method is **static**.

---

### rules

[](#rules)

{@inheritdoc}

```
URL::rules(  ): array
```

---

URL
---

[](#url-1)

Helper class for some actions with URLs

- Full name: \\NovemBit\\i18n\\system\\helpers\\URL

**See Also:**

-

### addQueryVars

[](#addqueryvars)

Adding query parameters to URL

```
URL::addQueryVars( string $url, string $name, string $value ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**string**Initial url`$name`**string**Parameter name (key)`$value`**string**Value of parameter---

### removeQueryVars

[](#removequeryvars)

Remove Query parameter from URL

```
URL::removeQueryVars( string $url, string $paramName ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$url`**string**Initial url`$paramName`**string**Parameter name (key)---

### buildUrl

[](#buildurl)

Build url from parts Same as reversed parse\_url

```
URL::buildUrl( array $parts ): string
```

- This method is **static**. **Parameters:**

ParameterTypeDescription`$parts`**array**Parts of url---

XML
---

[](#xml)

HTML type for translation component

- Full name: \\NovemBit\\i18n\\component\\translation\\type\\XML
- Parent class: \\NovemBit\\i18n\\component\\translation\\type\\Type

**See Also:**

-

### defaultConfig

[](#defaultconfig-6)

{@inheritDoc}

```
XML::defaultConfig(  ): array
```

- This method is **static**.

---

### getParserType

[](#getparsertype-2)

```
XML::getParserType(  ): integer
```

---

### setParserType

[](#setparsertype-2)

```
XML::setParserType( integer $parser_type )
```

**Parameters:**

ParameterTypeDescription`$parser_type`**integer**---

### buildToTranslateFields

[](#buildtotranslatefields-2)

```
XML::buildToTranslateFields( \DOMNode &$node, array $params, array &$data )
```

**Parameters:**

ParameterTypeDescription`$node`**\\DOMNode**`$params`**array**`$data`**array**---

### replaceTranslatedFields

[](#replacetranslatedfields-2)

```
XML::replaceTranslatedFields( \DOMNode &$node, array $params, array &$data )
```

**Parameters:**

ParameterTypeDescription`$node`**\\DOMNode**`$params`**array**`$data`**array**---

### getHelperAttributes

[](#gethelperattributes-2)

{@inheritDoc}

```
XML::getHelperAttributes(  ): boolean
```

---

### setHelperAttributes

[](#sethelperattributes-2)

{@inheritDoc}

```
XML::setHelperAttributes( boolean $status ): void
```

**Parameters:**

ParameterTypeDescription`$status`**boolean**If true then```
                html translation including additional attributes |

```

---

### addBeforeParseCallback

[](#addbeforeparsecallback-2)

```
XML::addBeforeParseCallback( callable $callback )
```

**Parameters:**

ParameterTypeDescription`$callback`**callable**---

### addAfterParseCallback

[](#addafterparsecallback-2)

```
XML::addAfterParseCallback( callable $callback )
```

**Parameters:**

ParameterTypeDescription`$callback`**callable**---

### getBeforeParseCallbacks

[](#getbeforeparsecallbacks-2)

```
XML::getBeforeParseCallbacks(  ): array
```

---

### getAfterParseCallbacks

[](#getafterparsecallbacks-2)

```
XML::getAfterParseCallbacks(  ): array
```

---

XML
---

[](#xml-1)

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:**

-

### get

[](#get-6)

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:**

ParameterTypeDescription`$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)---

### saveTranslations

[](#savetranslations-6)

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:**

ParameterTypeDescription`$from_language`**string**From language`$translations`**array**Translations of texts`$level`**integer**Level of translation`$overwrite`**boolean**Overwrite or not`$result`**array**---

### getDB

[](#getdb-7)

```
XML::getDB(  ): \Doctrine\DBAL\Connection
```

- This method is **static**.

---

---

> This document was automatically generated from source code comments on 2019-12-03 using [phpDocumentor](http://www.phpdoc.org/) and [cvuorinen/phpdoc-markdown-public](https://github.com/cvuorinen/phpdoc-markdown-public)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~44 days

Total

5

Last Release

2255d ago

PHP version history (2 changes)1.0.1-alphaPHP &gt;=7.0

1.0.3PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/759f35eb535bd0e8362784571e18d215e04dd4eb531c75d7b3b6a82bd5243a6d?d=identicon)[eyehollow](/maintainers/eyehollow)

---

Top Contributors

[![diazoxide](https://avatars.githubusercontent.com/u/25997814?v=4)](https://github.com/diazoxide "diazoxide (617 commits)")[![rossigee](https://avatars.githubusercontent.com/u/5194485?v=4)](https://github.com/rossigee "rossigee (2 commits)")[![AnieGH](https://avatars.githubusercontent.com/u/75842183?v=4)](https://github.com/AnieGH "AnieGH (1 commits)")

---

Tags

i18ni10n

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/novembit-i18n/health.svg)

```
[![Health](https://phpackages.com/badges/novembit-i18n/health.svg)](https://phpackages.com/packages/novembit-i18n)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[lexik/translation-bundle

This bundle allows to import translation files content into the database and provide a GUI to edit translations.

4362.7M19](/packages/lexik-translation-bundle)[jms/translation-bundle

Puts the Symfony Translation Component on steroids

42510.8M63](/packages/jms-translation-bundle)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
