What Is The Best Practice For Storing Text Of Websites With Different Languages

Hi everyone,

I am developing a website with different languages; user can change the language based on his preferences.

The text with different languages are stored in SQL database: English, Indonesian.

So far so good, until I stumble upon the following text:

"Click here to view the details"

where the "Click here" is a link.

I store the sentence in DB as the following:


en:

<a href="%LINK%">Click here</a> to view the details.


id:

<a href="%LINK%">Klik di sini</a> untuk melihat detail.

and then I apply str_replace to change the %LINK% to the link to display.

Is there a better way to do this?

What is the best Yii practice for this?

Please advise.

Thanks in advance.

Regards,

Ron

See This links

http://www.yiiframework.com/doc/guide/1.1/en/topics.i18n

Hope this will help you

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

Thanks for the reply Aneesh.

The examples are mostly static text, but in my case, the translated text has link in it.

You should only store and translate text.

You should do something like this:


CHtml::link(Yii::t('category','Click Here'), array('controller/action', 'param1' => 'value1', 'lang' => $lang));