TsTranslation ¶
Extension for Yii framework (version 1.1.*
).
Easy to make Yii applications (web pages) multilanguage.
You can discuss extension in TsTranslation topic .
Topic in Russain forum
You can try Demo of extension just now.
Easy to install, easy to use, many functionality... ¶
- Download latest version of TsTranslation extension ,
- Unpack
tstranslatin-*.*.*.zip
to extension folder of your Yii project:.../protected/extensions/tstranslation
, - Import
tstranslation.sql
into your database, - Read documentation and try Demo
Versions ¶
Version 1.1.0 ¶
Added message delete method
~~~ [php] TsTranslation::delete() ~~~
- Fixed bug associated with "dynamic content translation" model attributes (now not necessary define translatable attributes in model).
- Added functionality to use another Db Connection for extension.
Version 1.1.1 ¶
Fixed issue associated with TsTranslation::save() method. Now standart messages also can be saved, regardless it instanceof CActiveRecord or not
~~~ [php] TsTranslation::save('category', 'message') ~~~
awesome!
This is a great extension, but i would like to use the 'path' url format.
Is this possible with this extension??
thnks...
Re: I would like to use the 'path' url format (martijnjonkers)
Certainly, without any problem you can use all available parameters for url Manager, and
'urlFormat' => 'path'
also. But if you use custom url rules and you want that language was shown in url, it is recommended to set parameter
'prependLangRules' => false
, and add language rules manually.
/** * Set `showLangInUrl` parameter (NOT REQUIRED), * * AVAIBLE VALUES: * - `true` means language code shows in url. Example: .../mysite/en/article/create * - `false` means language code not shows in url. Example: .../mysite/article/create * DEFAULT VALUE: `true` */ 'showLangInUrl' => true, /** * Set `prependLangRules` parameter (NOT REQUIRED), * this parameter takes effect only if `showLangInUrl` parameter is `true`. * It strongly recomended to add language rule to `rules` parameter handly * * AVAIBLES VALUES: * - `true` means automaticly prepends `_lang` parameter before all rules. * Example: '<_lang:\w+><controller:\w+>/<id:\d+>' => '<controller>/view', * - `false` means `_lang` parameter you must add handly * DEFAULT VALUE: `true` */ 'prependLangRules' => true,
stil not working
Thanks,
when i use:
'class' => 'TsUrlManager', 'showLangInUrl' => true, 'prependLangRules' => true, 'urlFormat'=>'path', 'showScriptName' => false,
I get unknown action name "_lang". the url called is: http://www.example.com/user/_lang/nl
The link works when i specify a action name like: http://www.example.com/user/index/_lang/nl
but now the language does not change anymore.
i use
Yii::app()->createUrl( 'user' );
to create the link
Re: stil not working (martijnjonkers)
It recommended to create url like this
Yii::app()->createUrl( 'user/index' ). Yii::app()->createUrl('module/controller/action', $params = array())
'_lang' must be parameter, not an action.
Please post here 'rules' parameter of 'urlManager' from your config file.
rules
i did not set any rules, i left it default.
Re: rules (martijnjonkers)
It menas your rules are
'rules'=>array( '<controller:\w+>/<id:\d+>'=>'<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', '<controller:\w+>/<action:\w+>'=>'<controller>/<action>', ),
Is it?
it works!
i got it working, needed to setup the rules correctly;)
'urlManager' => array( 'class' => 'TsUrlManager', 'showLangInUrl' => true, 'prependLangRules' => true, /******************************/ 'urlFormat'=>'path', 'showScriptName' => false, 'rules'=>array( '<controller:\w+>'=>'<controller>', '<controller:\w+>/<id:\d+>'=>'<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', '<controller:\w+>/<action:\w+>'=>'<controller>/<action>', '<module:\w+>/<controller:\w+>/<action:\w+>'=>'<module>/<controller>/<action>', '<module:\w+>/<controller:\w+>'=>'<module>/<controller>', '<module:\w+>'=>'<module>', ), ),
now i get http://www.example.com/en/user when i use Yii::app()->createUrl( 'user' )
thnx,
Re: it works! (martijnjonkers)
Thanks you too. If there will be any questions please.
Thanks for using tstranslation ))
no bootstrap
Hi again.
Is is possible to get this working without bootstrap?
trtranslation looks and works great with bootstrap enabled, but it messes up my current interface.
When i disable bootstrap i can't open any of the tabs.
thnx.
Re: no bootstrap (martijnjonkers)
Sorry, but bootstrap required in TsTranslationWidget, (in TsLanguageWidget uses only if parameter 'type'=>'dropdown').
You can call TsTranslationWidget in separate action, bootstrap must includes only in that action and will be mess only that page.
If I have time I fix issue associated with bootstrap (I will be write required scripts and styles manualy, so as not to connect bootstrap)
very good
i am having trouble showing the categories (site/contact,site/login etc)when i click translate , how is it possible i follow all the rules mentioned
Re: Ilein (trouble showing the categories)
Hi.
It may be javascript conflict (bootstrap with other script in page), or js error, which stops script execution behind him.
Please check your console and put here screenshot of error (if error exists).
Thanks.
Great extension
THANKS FOR THIS GREAT EXTENSION
not showing the categories
Uncaught TypeError: Cannot read property 'Constructor' of undefinedbootstrap-editable.min.js:5 (anonymous function)bootstrap-editable.min.js:5 (anonymous function)
Re: not showing the categories
Hi.
Sorry for inconveniences.
It means that bootstrap-editable.js loads before bootstrap loading, or in page loaded bootstrap 2.
If first version, try to change script load position: change POS_HEAD to POS_BEGIN https://github.com/TaronSaribekyan/TsTranslation/blob/master/widgets/TsTranslationWidget.php#L11 (don't know why I set parameter scriptPosition as private :) ).
In second version you need to disable bootstrap 2 loading on page with widget call.
If that, please response.
Thanks.
Re: not showing the categories
FIREFOX shows error:
Use of getPreventDefault() is deprecated. Use defaultPrevented instead. jquery.js:3255
Empty string passed to getElementById(). jquery.js:140
CHROME shows:
Failed to load resource: net::ERR_CACHE_MISS
Re: not showing the categories
JS code tested, everything is ok. Be sure that in page there calls TsTranslatin Widget loaded only bootstrap 3 (note 2).
If you use bootstrap 2 in your project, you must disable it loading and enable bootstrap 3 loading from widget, in that page there calls TsTranslatin Widget.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.