Class lajax\translatemanager\widgets\ToggleTranslate

Inheritancelajax\translatemanager\widgets\ToggleTranslate » yii\base\Widget
Available since version1.0

Widget that displays button for switching to translating mode.

Simple example:

\lajax\translatemanager\widgets\ToggleTranslate::widget();

Example for changing position:

\lajax\translatemanager\widgets\ToggleTranslate::widget([
 'position' => \lajax\translatemanager\widgets\ToggleTranslate::POSITION_TOP_RIGHT,
]);

Example for changing skin:

\lajax\translatemanager\widgets\ToggleTranslate::widget([
 'frontendTranslationAsset' => 'lajax\translatemanager\bundles\FrontendTranslationAsset',
]);

Example for changing template and skin:

\lajax\translatemanager\widgets\ToggleTranslate::widget([
 'template' => '<a href="javascript:void(0);" id="toggle-translate" class="{position}" data-language="{language}" data-url="{url}"><i></i> {text}</a><div id="translate-manager-div"></div>',
 'frontendTranslationAsset' => 'lajax\translatemanager\bundles\FrontendTranslationAsset',
]);

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$frontendTranslationAsset string Added StyleSheets and their dependencies lajax\translatemanager\widgets\ToggleTranslate
$frontendTranslationPluginAsset string Added JavaScripts and their dependencies lajax\translatemanager\widgets\ToggleTranslate
$position string The position of the translate mode switch button relative to the screen. lajax\translatemanager\widgets\ToggleTranslate
$template string The template of the translate mode switch button. lajax\translatemanager\widgets\ToggleTranslate

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
DIALOG_URL '/translatemanager/language/dialog' Url of the dialog window. lajax\translatemanager\widgets\ToggleTranslate
POSITION_BOTTOM_LEFT 'bottom-left' Button in bottom left corner. lajax\translatemanager\widgets\ToggleTranslate
POSITION_BOTTOM_RIGHT 'bottom-right' Button in bottom right corner. lajax\translatemanager\widgets\ToggleTranslate
POSITION_TOP_LEFT 'top-left' Button in top left corner. lajax\translatemanager\widgets\ToggleTranslate
POSITION_TOP_RIGHT 'top-right' Button in top right corner. lajax\translatemanager\widgets\ToggleTranslate

Property Details

$frontendTranslationAsset public property

Added StyleSheets and their dependencies

public string $frontendTranslationAsset 'lajax\translatemanager\bundles\FrontendTranslationAsset'
$frontendTranslationPluginAsset public property

Added JavaScripts and their dependencies

public string $frontendTranslationPluginAsset 'lajax\translatemanager\bundles\FrontendTranslationPluginAsset'
$position public property

The position of the translate mode switch button relative to the screen. Pre-defined positions: bottom-left (default), bottom-right, top-left, top-tright.

public string $position 'bottom-left'
$template public property

The template of the translate mode switch button.

public string $template '<a href="javascript:void(0);" id="toggle-translate" class="{position}" data-language="{language}" data-url="{url}"><i></i> {text}</a><div id="translate-manager-div"></div>'

Method Details

run() public method

public void run ( )