Class lispa\amos\core\i18n\MessageSource

Inheritancelispa\amos\core\i18n\MessageSource » yii\i18n\DbMessageSource » yii\i18n\MessageSource » yii\base\Component » yii\base\Object
Implementsyii\base\Configurable

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$autoUpdate boolean Enable autoUpdate db-files i18n lispa\amos\core\i18n\MessageSource
$behaviors yii\base\Behavior[] List of behaviors attached to this component yii\base\Component
$cache yii\caching\Cache|array|string The cache object or the application component ID of the cache object. yii\i18n\DbMessageSource
$cachingDuration integer The time in seconds that the messages can remain valid in cache. yii\i18n\DbMessageSource
$db yii\db\Connection|array|string The DB connection object or the application component ID of the DB connection. yii\i18n\DbMessageSource
$defaultLanguage string If the translation of the current language is not set you can translate it in the default language if it is set lispa\amos\core\i18n\MessageSource
$enableCaching boolean Whether to enable caching translated messages yii\i18n\DbMessageSource
$extraCategoryPaths array More paths [key] => [pathstring] to parse for translations lispa\amos\core\i18n\MessageSource
$forceTranslation boolean Whether to force message translation when the source and target languages are the same. yii\i18n\MessageSource
$messageTable string The name of the translated message table. yii\i18n\DbMessageSource
$sourceLanguage string The language that the original messages are in. yii\i18n\MessageSource
$sourceMessageTable string The name of the source message table. yii\i18n\DbMessageSource

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$dbCategoryCache array With results from database lispa\amos\core\i18n\MessageSource

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\Component
__clone() This method is called after the object is created by cloning an existing one. yii\base\Component
__construct() Constructor. yii\base\Object
__get() Returns the value of a component property. yii\base\Component
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Component
__set() Sets the value of a component property. yii\base\Component
__unset() Sets a component property to be null. yii\base\Component
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
behaviors() Returns a list of behaviors that this component should behave as. yii\base\Component
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Component
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Component
className() Returns the fully qualified name of this class. yii\base\Object
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMethod() Returns a value indicating whether a method is defined. yii\base\Component
hasProperty() Returns a value indicating whether a property is defined for this component. yii\base\Component
init() lispa\amos\core\i18n\MessageSource
off() Detaches an existing event handler from this component. yii\base\Component
on() Attaches an event handler to an event. yii\base\Component
translate() Tranlate wrapper with file fetching via HybridMessageSource lispa\amos\core\i18n\MessageSource
trigger() Triggers an event. yii\base\Component

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
addTranslationByPath() lispa\amos\core\i18n\MessageSource
alignDbAndTranslate() Align database with texts from module i18n files lispa\amos\core\i18n\MessageSource
createFallbackQuery() The method builds the yii\db\Query object for the fallback language messages search. yii\i18n\DbMessageSource
loadMessages() lispa\amos\core\i18n\MessageSource
loadMessagesFromDb() Loads the messages from database. yii\i18n\DbMessageSource
translateMessage() Translates the specified message. yii\i18n\MessageSource

Events

Hide inherited events

EventTypeDescriptionDefined By
EVENT_MISSING_TRANSLATION yii\i18n\MissingTranslationEvent An event that is triggered when a message translation is not found. yii\i18n\MessageSource

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
CACHE_KEY_PREFIX 'DbMessageSource' Prefix which would be used when generating cache key. Deprecated This constant has never been used and will be removed in 2.1.0. yii\i18n\DbMessageSource

Property Details

$autoUpdate public property

Enable autoUpdate db-files i18n

public boolean $autoUpdate false
$dbCategoryCache protected static property

With results from database

protected static array $dbCategoryCache = []
$defaultLanguage public property

If the translation of the current language is not set you can translate it in the default language if it is set

public string $defaultLanguage null
$extraCategoryPaths public property

More paths [key] => [pathstring] to parse for translations

Method Details

addTranslationByPath() protected method

protected mixed addTranslationByPath ( $category, $message, $language, $pathLanguage )
$category
$message
$language
$pathLanguage
alignDbAndTranslate() protected method

Align database with texts from module i18n files

protected mixed alignDbAndTranslate ( $category, $message, $language, $messageSource )
$category
$message
$language
$messageSource
init() public method

public void init ( )
loadMessages() protected method

protected array loadMessages ( $category, $language )
$category string
$language string
translate() public method

Tranlate wrapper with file fetching via HybridMessageSource

public boolean|string translate ( $category, $message, $language )
$category string
$message string
$language string