@@ -27,6 +27,55 @@ public function __construct(Zend_Controller_Request_Abstract $request, Zend_Cont
27
27
*/
28
28
public function preDispatch ()
29
29
{
30
+ // Init the translater
31
+ if (!$ this ->isDebug ())
32
+ {
33
+ $ frontendOptions =array (
34
+ 'lifetime ' =>86400 ,'automatic_serialization ' =>true
35
+ );
36
+
37
+ $ backendOptions =array (
38
+ 'cache_dir ' =>BASE_PATH .'/tmp/cache/translation '
39
+ );
40
+ $ cache =Zend_Cache::factory ('Core ' ,'File ' ,$ frontendOptions ,$ backendOptions );
41
+ Zend_Translate::setCache ($ cache );
42
+ }
43
+ $ translate =new Zend_Translate ('csv ' ,BASE_PATH .'/translation/fr-main.csv ' ,'en ' );
44
+ Zend_Registry::set ('translater ' ,$ translate );
45
+
46
+ $ translaters =array ();
47
+ $ configs =array ();
48
+ $ modulesEnable = Zend_Registry::get ('modulesEnable ' );
49
+ foreach ($ modulesEnable as $ module )
50
+ {
51
+ $ translaters [$ module ]=new Zend_Translate ('csv ' ,BASE_PATH ."/modules/ $ module/translation/fr-main.csv " ,"en " );
52
+ $ configs [$ module ]= new Zend_Config_Ini (BASE_PATH ."/modules/ $ module/configs/module.ini " , 'global ' );
53
+ }
54
+ Zend_Registry::set ('translatersModules ' ,$ translaters );
55
+ Zend_Registry::set ('configsModules ' ,$ configs );
56
+
57
+ $ forward =$ this ->_getParam ("forwardModule " );
58
+ $ request = $ this ->getRequest ();
59
+ $ response = $ this ->getResponse ();
60
+ if (!isset ($ forward ))
61
+ {
62
+ foreach ($ configs as $ key => $ config )
63
+ {
64
+ if ($ config ->system ==1 )
65
+ {
66
+ if (file_exists (BASE_PATH .'/modules/ ' .$ key .'/controllers/ ' . ucfirst ($ request ->getControllerName ()).'CoreController.php ' ))
67
+ {
68
+ include_once BASE_PATH .'/modules/ ' .$ key .'/controllers/ ' . ucfirst ($ request ->getControllerName ()).'CoreController.php ' ;
69
+ $ name =ucfirst ($ key ).'_ ' .ucfirst ($ request ->getControllerName ()).'CoreController ' ;
70
+ $ controller =new $ name ($ request ,$ response );
71
+ if (method_exists ($ controller , $ request ->getActionName ().'Action ' ))
72
+ {
73
+ $ this ->_forward ($ request ->getActionName (), $ request ->getControllerName ().'Core ' , $ key ,array ('forwardModule ' =>true ));
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
30
79
parent ::preDispatch ();
31
80
if (!$ this ->isDebug ())
32
81
{
0 commit comments