Create multilingual site in Yii

Hi everyone,

First of all I would like to wish happy new year to everyone here.:)

Now come to my problem. well i am creating a multilingual platform in yii. I know the Internationalization in yii and i have implemented it also.But now what i am looking for is.A text should be manageable from back end of the platform.

Can anybody give me some good idea to start this work.that how to manage the static words and change language with request.Since I do not want to hardcore any of a code that is why i am looking for any powerful and good approach for this task.

Your advice and ideas are very important for me.!!

Looking forward for some good solutions :)

Thanks in Advance…!!!

You can do this by creating a database table which store information about the text you want to be used for your site.

For example


variables table

id name

1 SiteName

2 Contact


Language Table

id name 

1  English


Variable_Language

variable_id Language_id Translation

1           1           SiteName

2           1           Contact us

Hope this will help you…

Thanks for your reply PeRoChAk !

But can you please tell me then what will be a procedure to write this data on message file.since we define a array of text in message file.Like…




<?php

return array (

'Title' => 'Titre',

'Content' => 'contenu',

);

?>



i am a bit inquisitive to about it…:( .can you please guide me here…what will be a stranded Yii method to do it.

Thanks again for your reply.

Check this:

http://www.yiiframework.com/extension/translate/

And the related:

http://www.yiiframework.com/extension/langhandler/

http://www.yiiframework.com/extension/stranslateablebehavior/

Thank jacmoe, for your quick reply.I’ll check this extensions and let you know about my experience of playing with them.:)

thank you again !!

To use this concept, you need to have three tables as I have said

Variables // Will contain the variables that you want to translate

Languages // Language that you want to use for the application

Translation // Translation of variable to specific language

How it will be used?

First of All when a user first time enters the site, default language will be used.

If user wants to change the language, then this language will be used as default for the content and you can set this language using config of Yii application.

Thanks PeRoChAk, for your reply. :)

But i have done this task as jacmoe suggest a translate extension. :) it works perfectly as i want.But still your advice is also very helpful.

thanks again :)