SourceMessageTooltip displays a tooltip that shows the category and the default translate message when the user press CTRL+SHIFT on any text on the front or back end interface. This may be usefull for any users that wants to quickly find the related SourceMessage of any translated messages.
This also can be used to find out if there is already any existings translations before your start doing so for a text which is not yet.
If you set forceTranslation to true for the messages component as declared in main.php Then you can even use this for a single language website and then give your customer the possibility to change any single piece of text on his/her website using CDbMessageSource. (You should also use the cachingDuration parameter as well)
Note that it is based on possible match since there are no modification of the DOM that could break DOM structure. (Perhaps in later version if any ideas come through my mind)
Works on Chrome,Firefox, IE (tested on IE8)
1) In you config/main.php :
'components'=>array( 'sourceMessageTooltip'=>array( 'class'=>'application.extensions.SourceMessageTooltip.SourceMessageTooltip', 'role' => 'admin' ), ),
2) With role being the user role needed to enable the tool.
3) You also need to modify a bit of your index.php as follow:
In you index.php :
// you need to change the first line to link to the derivated Yii class that performs Yii::t() calls $yii=dirname(__FILE__).'/protected/extensions/SourceMessageTooltip/yii.php'; // add this line so it link to the location of YiiBase.php in the yii framework folder $yiibase=dirname(__FILE__).'/vendors/yii/1.1.9/YiiBase.php'; //... code ... //... code ... // add this line before the require_once($yii); statement require_once($yiibase); require_once($yii); //... code ...
There are two ways to trigger the tooltip:
Press CTRL+SHIFT while your mouse is over any html element
Or Select any text with your mouse and press CTRL+SHIFT to query for a more specific piece of text.
Tested on Chrome, Firefox and IE (tested on IE8)
If any troubles with labels html element, try to press CTRL+SHIFT before releasing the mouse key as you select the text
v0.3: Trigger key changed to CTRL+SHIFT. Fixed for IE (tested on IE8)