Setting language

I successfully changed the language for my Yii application to portuguese by changing the main.php and adding:




	'language'=>'pt',



However strangely when i look at the source of the generated pages at the header this is what i get




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http_//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http_//www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	<meta name="language" content="en" />



Also when displaying zii.widgets.grid.CGridView widget i get the pagination messages in english.

What should i do more ?

PS: I changed the : in the URL otherwise i couldn’t post.

Hi Artur,

the HTML is defined in the layout used by your application. Take a look at the folder protected/views/layouts. If you are using the webapp created by Yii command line tool, you should find a file called main.html there. This is the main HTML layout, and as you can see, the <meta> language element is hard coded (same for the 'lang attribute).

You should make it dynamic, something like :

[html]

  &lt;html xmlns=&quot;http_//www.w3.org/1999/xhtml&quot; 


           	xml:lang=&quot;&lt;?php echo Yii::app()-&gt;language; ?&gt;&quot; 


              lang=&quot;&lt;?php echo Yii::app()-&gt;language; ?&quot;&gt;

[/html]

Hope this helps

8)