Translate module

Hey jowen

you probably missed to import the TranslateModule class, like


    'import'=>array(         'application.modules.translate.TranslateModule'     ),

also, try to turn on debug mode so you can see what is the error

Hi Gustavo,




'import'=>array(         'application.modules.translate.TranslateModule'     ),

The page still become blank even i add this line inside config/main. Debug mode didn’t show anything,just whole pages become blanks.

Seem this line cause my page turn blanks once add this in


'onMissingTranslation' => array('TranslateModule', 'missingTranslation'),

.

Thanks.

@Gustavo: Glad to find someone with the same issue

I am currently tinkering with UserGroups and Translate Module to fix this issue, without complete success. I am also using this technique. I’m really confused about the hierarchy of processing of modules, controllers, and components.

  1. How do I fix the issue (such that using language-indicating URLs are properly processed, routed and missing translations in the UserGroups module get added (wherever Yii::t has been used there) )?

  2. Can you give me some docs/links to understand the differences between and order of execution of the above?

i want to add that dropdown from my database

how i use?

"The best way would be to use CHtml::listData method passing the languages model as parameter"

where ?




TranslateModule::$acceptedLanguages = CHtml::listData;

TranslateModule::$defaultLanguage = 'en';

TranslateModule::setLanguage('en');



I stared using this module but I didn’t like the dropdown() language selector and wanted links to change the language.

A simple re-work of the dropdown() code.




    /**

     * generates a link for switching to the language specified

     * @param string $string will be handled to CHtml::link, same conditions apply

     * @param string $language should be an acceptable language, validity is not checked

     * @return string

     */

    function setLangLink($string='language link', $language='en')

    {

        Yii::app()->getClientScript()->registerScript(self::ID.'-link-'.$language,'

           $("#'.self::ID.'-link-'.$language.'").on("click", function(){

                $.post(

                    "'.Yii::app()->getController()->createUrl("/translate/translate/set").'",

                    {"'.self::ID.'":"'.$language.'"},

                    function(){window.top.location.reload();}

                );

            });

        ');

        return CHtml::link($string, '#'.$language, array('id '=>self::ID.'-link-'.$language) );

    }



Hi i am newbie in yii,but i want to know is this extension work according to database.

mean’s all the data of site change according to my database.If yes then please let me know the whole process.

Thank’s

Need some examples how to use it.

Please share some examples how can we use it in model, view and controller?