How to translate attribute names?

I’m trying to translate error messages for a Japanese site. I’ve created a custom message file in my protected folder and all is fine.

But I’m now getting a problem. The {attribute} name isn’t getting translated.

How do I go about translating the attribute names?


{attribute} is too long (maximum is {max} characters).

Tip が長過ぎます(最大 140 キャラクタ)。



Attribute name?

Arent you being able to translate them in your model’s attribute labels function?

public function attributeLabels()


	return array(

		'id' => 'ID',

		'attributenamehere' => Yii::t(.... translation keys here,




PS: Dont have a clue about that japanese up there… :)

Doh! :^) That’s embarrassing. I totally thought I did that, but I’d only translated the first one.

Sorry about that. Thanks for the help, though.



Yeah, it happens and mostly when you are the one putting all the pieces together… congrats

Yeah, esp because I really have three sites in one. I have an English site that I built first. Then, I just copied the entire site into a /jp folder off of the main one, since it was quick and it wasn’t immediately clear as to how to accommodate different language versions in the same site. I first tried to link the /jp site to the upper site’s models/controllers/etc in the bootstrap, but that didn’t seem to work. So, i just made it a “JP” site and put in my own custom messages (along with all of the rest from “ja”).

Then, I have a third site in the /admin folder for back-end administration of the data.

FYI, the promo is at

Thanks YII! I love the framework!