Yii 1.1: tstranslation

Yii multilanguage extension with dynamic content translate functionality


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


Version 1.1.0

  • Added message delete method

  • 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

    TsTranslation::save('category', 'message')

Total 17 comments

#18737 report it
Taron Saribekyan at 2014/12/21 01:28pm
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.

#18736 report it
hajdar at 2014/12/20 04:24am
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

#18732 report it
Taron Saribekyan at 2014/12/18 01:11pm
Re: not showing the categories

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.

#18728 report it
hajdar at 2014/12/18 07:39am
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)

#18720 report it
hajdar at 2014/12/17 05:30am
Great extension


#18671 report it
Taron Saribekyan at 2014/12/10 06:43am
Re: Ilein (trouble showing the categories)

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).

#18666 report it
Ilein at 2014/12/09 08:47am
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

#18009 report it
Taron Saribekyan at 2014/08/26 03:42am
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)

#18004 report it
martijnjonkers at 2014/08/25 03:45pm
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.


#18002 report it
Taron Saribekyan at 2014/08/25 07:57am
Re: it works! (martijnjonkers)

Thanks you too. If there will be any questions please.

Thanks for using tstranslation ))

#18001 report it
martijnjonkers at 2014/08/25 05:11am
it works!

i got it working, needed to setup the rules correctly;)

'urlManager' => array(
            'class' => 'TsUrlManager',
            'showLangInUrl' => true,
            'prependLangRules' => true,
            'showScriptName' => false,

now i get http://www.example.com/en/user when i use Yii::app()->createUrl( 'user' )


#18000 report it
Taron Saribekyan at 2014/08/25 05:08am
Re: rules (martijnjonkers)

It menas your rules are


Is it?

#17998 report it
martijnjonkers at 2014/08/25 04:40am

i did not set any rules, i left it default.

#17997 report it
Taron Saribekyan at 2014/08/25 04:33am
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.

#17995 report it
martijnjonkers at 2014/08/25 03:33am
stil not working


when i use:

'class' => 'TsUrlManager',
            'showLangInUrl' => true,
            'prependLangRules' => true,
            '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

#17990 report it
Taron Saribekyan at 2014/08/23 07:59am
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),
 * - `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
 * - `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,
#17983 report it
martijnjonkers at 2014/08/21 10:08am

This is a great extension, but i would like to use the 'path' url format. Is this possible with this extension??


Leave a comment

Please to leave your comment.

Create extension