Class lispa\amos\core\i18n\MessageSource
Inheritance | lispa\amos\core\i18n\MessageSource » yii\i18n\DbMessageSource » yii\i18n\MessageSource » yii\base\Component » yii\base\Object |
---|---|
Implements | yii\base\Configurable |
Public Properties
Property | Type | Description | Defined 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
Property | Type | Description | Defined By |
---|---|---|---|
$dbCategoryCache | array | With results from database | lispa\amos\core\i18n\MessageSource |
Public Methods
Method | Description | Defined 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
Method | Description | Defined 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
Event | Type | Description | Defined By |
---|---|---|---|
EVENT_MISSING_TRANSLATION | yii\i18n\MissingTranslationEvent | An event that is triggered when a message translation is not found. | yii\i18n\MessageSource |
Constants
Constant | Value | Description | Defined 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
Enable autoUpdate db-files i18n
With results from database
If the translation of the current language is not set you can translate it in the default language if it is set
More paths [key] => [pathstring] to parse for translations
Method Details
protected mixed addTranslationByPath ( $category, $message, $language, $pathLanguage ) | ||
$category | ||
$message | ||
$language | ||
$pathLanguage |
Align database with texts from module i18n files
protected mixed alignDbAndTranslate ( $category, $message, $language, $messageSource ) | ||
$category | ||
$message | ||
$language | ||
$messageSource |
public void init ( ) |
protected array loadMessages ( $category, $language ) | ||
$category | string | |
$language | string |
Tranlate wrapper with file fetching via HybridMessageSource
public boolean|string translate ( $category, $message, $language ) | ||
$category | string | |
$message | string | |
$language | string |