widget i18n

for example I have


Yii::t('aWord.bWord', 'test')

What is the directory structure needed to translate the widget?

I assumed that in messages in the main app, i should have aWord.php or something…

But it don’t works…

the documentation don’t help me to figure this issue

From API reference

/Tommy

I know the documentation, but without a real example I can’t understand it

For example I have


Yii::t('PerformanceStats.widgets', 'Queries');



I have protected/messages/ru/widgets.php

What to put in widgets to translate the Queries word to something else?

none of this work:




<?php

return array(

	'Queries' => 'abrakadabra1',

	'PerformanceStats' => array(

		'Queries' => 'abrakadabra2',

	),

	'PerformanceStats.widgets' => array(

		'Queries' => 'abrakadabra3',

	),

);



I just get Queries

If I change it to

Yii::t(‘widgets’, ‘Queries’)

I get abrakadabra1 … but I want to benefit from the

PerformanceStats.widgets

Finally got it …

But I don’t like it…

For example I have components directory

And widgets directory where I hold my widgets…

So if I trying PerformanceStats.widgets

I need to put inside widgets directory

messages/ru/widgets.php

to translate with Yii::t(‘PerformanceStats.widgets’


But I want something else

I want it to use protected/messages/ru/widgets.php

And inside widgets.php I want it to find


'PerformanceStats' => array()

And there I want my translation…

This is looks more logical to me…

Or I would forced to put every widget inside his own directory or something.

Actually reference is not very clear at that point, IMHO. If I do not go wrong, Xyz is the name of the widget class (even if different from its folder name). So for example, if you have a widget class "MyWidget" in the folder "extensions/widgets/art/MyWidget.php" you should:

[list=1]

[*]Create a "messages" folder under "extensions/widgets/art" ( = "extensions/widgets/art/messages").

[*]Create locale ID subfolders for every language (ex. "extensions/widgets/art/messages/de").

[*]Create translation files named like "categoryName".

[*]Use :

[/list]


Yii::t('MyWidget.categoryName', 'what i want to translate here');