Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUG Fix i18nTextCollector restriction to specific modules

i18nTextCollector takes an argument to restrict text collection to specific modules.
This used to restrict by limiting the modules scanned by the text collector. But
modules can actually provide translations for other modules (see for e.g.
CMSMenu#provideI18nEntities)

This patch changes the text collector to scan all modules, and then apply the restriction
to the output
  • Loading branch information...
commit b25b45aab4d519a58bbb428d21539a3ef4e0a37e 1 parent dc18c51
@hafriedlander hafriedlander authored
Showing with 8 additions and 10 deletions.
  1. +8 −10 i18n/i18nTextCollector.php
View
18 i18n/i18nTextCollector.php
@@ -75,21 +75,12 @@ public function getWriter() {
public function run($restrictToModules = null) {
//Debug::message("Collecting text...", false);
- $modules = array();
+ $modules = scandir($this->basePath);
$themeFolders = array();
// A master string tables array (one mst per module)
$entitiesByModule = array();
- //Search for and process existent modules, or use the passed one instead
- if($restrictToModules && count($restrictToModules)) {
- foreach($restrictToModules as $restrictToModule) {
- $modules[] = basename($restrictToModule);
- }
- } else {
- $modules = scandir($this->basePath);
- }
-
foreach($modules as $index => $module){
if($module != 'themes') continue;
else {
@@ -145,6 +136,13 @@ public function run($restrictToModules = null) {
}
}
+ // Restrict modules we update to just the specified ones (if any passed)
+ if($restrictToModules && count($restrictToModules)) {
+ foreach (array_diff(array_keys($entitiesByModule), $restrictToModules) as $module) {
+ unset($entitiesByModule[$module]);
+ }
+ }
+
// Write each module language file
if($entitiesByModule) foreach($entitiesByModule as $module => $entities) {
$this->getWriter()->write($entities, $this->defaultLocale, $this->baseSavePath . '/' . $module);
Please sign in to comment.
Something went wrong with that request. Please try again.