Translate Application

To translate an app I read in some post that you only need to write

'language'=>'es', // Este es el lenguaje en el que querés que muestre las cosas


in the main.php

As I see this is for translate some messages, the error messages for example. My doubt is how can I translate something in the view of a CRUD file, for example I created a Countrys crud. If I wanna modify the 'new countrys' option for 'nuevo pais' how is the correct way, just changing it in the views/countrys file or there are other way.

Another question is where are the other messages that are translated in case I need to change some message for example: 'Error you mustn't leave the name blank' instead of 'Error you mustn't leave the name null'

Thank you very much in advance.

You need to use view translation together with message translation. For the former, you mainly need to create translated view files (es/viewName.php). For the latter (error messages, labels, etc.), you need to use Yii::t() at appropriate places.

Thanks a lot. I made some translation in the view files. It's are in spanish and I am having troubles with the acentos(áéíóú and ñ signs) how can I solve them.

Thanks a lot again.

Make sure your file is utf8 encoded, then there should be no problem with special characters

Also take a look here:


Excellent, the problem was in the text editor, I write Administración and save but I save it with other codification, I change the editor to UTF-8 and now is showing it perfect. Thanks.

I also solved my problem by change my netbeans editor to UTF-8. Thanks to this topic.

Below the forum also help me to setup i18i for my web apps:


Thanks all again.