Using Module Translations In Main Application [Solved]

I have contact module:


controllers/

	SiteController.php


modules/

	contact/

		messages/

			en/

				source.php

			sr/

				source.php

/en/source.php


<?php

return array (

  'ModuleName' => 'Contact',

);

?>

/sr/source.php


<?php

return array (

  'ModuleName' => 'Kontakt',

);

?>

And in main app (SiteController) I have action which lists all active modules and displays their translated names. In each source.php file there is a translation of module name.

How to display translated module names in SiteController action ?

I needed to write down a brief notice in buy to thanks for all the fantastic suggestions you’re placing at yii.te.gd. My prolonged internet lookup has at the finish of the day been recognized with reliable details and techniques to trade with my co-workers. I would assert that several of us readers really are seriously lucky to live in a important location with quite several excellent individuals with insightful pointers. good luck

I solved my problem like this:




<?php if(!empty($modules)){?>


<h3>Modules</h3>

<h4 class="subheader">Administration</h4>


<ul id="blocks" class="block-five dash">

	<?php foreach($modules as $module){ ?>

	<li>

		<a href="/<?php echo $module->module_name;?>/admin">

			<div class="inner">

				<?php 


				$module_translation = include(Yii::getPathOfAlias('application.modules.'.$module->module_name.'.messages').'/'.Yii::app()->language.'/source.php');

				echo $module_translation['ModuleName'];


				?>

			</div>

		</a>

	</li>

	<?php } ?>

</ul>


<?php } ?>