@@ -204,6 +204,9 @@ protected function setConfig($config)
204
204
if (!isset ($ this ->_config ['theme ' ])) {
205
205
$ this ->_config ['theme ' ] = $ this ->_viewDesign ->getDesignTheme ()->getId ();
206
206
}
207
+ if (!isset ($ this ->_config ['module ' ])) {
208
+ $ this ->_config ['module ' ] = $ this ->getControllerModuleName ();
209
+ }
207
210
return $ this ;
208
211
}
209
212
@@ -232,14 +235,39 @@ protected function getConfig($key)
232
235
return null ;
233
236
}
234
237
238
+ /**
239
+ * Retrieve name of the current module
240
+ * @return mixed
241
+ */
242
+ protected function getControllerModuleName ()
243
+ {
244
+ return $ this ->request ->getControllerModule ();
245
+ }
246
+
235
247
/**
236
248
* Load data from module translation files
237
249
*
238
250
* @return $this
239
251
*/
240
252
protected function _loadModuleTranslation ()
241
253
{
242
- foreach ($ this ->_moduleList ->getNames () as $ module ) {
254
+ $ currentModule = $ this ->getControllerModuleName ();
255
+ $ allModulesExceptCurrent = array_diff ($ this ->_moduleList ->getNames (), [$ currentModule ]);
256
+
257
+ $ this ->loadModuleTranslationByModulesList ($ allModulesExceptCurrent );
258
+ $ this ->loadModuleTranslationByModulesList ([$ currentModule ]);
259
+ return $ this ;
260
+ }
261
+
262
+ /**
263
+ * Load data from module translation files by list of modules
264
+ *
265
+ * @param array $modules
266
+ * @return $this
267
+ */
268
+ protected function loadModuleTranslationByModulesList (array $ modules )
269
+ {
270
+ foreach ($ modules as $ module ) {
243
271
$ moduleFilePath = $ this ->_getModuleTranslationFile ($ module , $ this ->getLocale ());
244
272
$ this ->_addData ($ this ->_getFileData ($ moduleFilePath ));
245
273
}
@@ -428,6 +456,9 @@ protected function getCacheId($forceReload = false)
428
456
if (isset ($ this ->_config ['theme ' ])) {
429
457
$ this ->_cacheId .= '_ ' . $ this ->_config ['theme ' ];
430
458
}
459
+ if (isset ($ this ->_config ['module ' ])) {
460
+ $ this ->_cacheId .= '_ ' . $ this ->_config ['module ' ];
461
+ }
431
462
}
432
463
return $ this ->_cacheId ;
433
464
}
0 commit comments