@@ 115-131 (lines=17) @@ | ||
112 | * |
|
113 | * @return int total number of files imported |
|
114 | */ |
|
115 | private function importAllBundlesTranslationFiles(ImportCommand $importCommand) |
|
116 | { |
|
117 | $bundles = array_map('strtolower', array_keys($this->kernel->getBundles())); |
|
118 | $imported = 0; |
|
119 | ||
120 | foreach ($bundles as $bundle) { |
|
121 | $importCommand->setDefaultBundle($bundle); |
|
122 | ||
123 | try { |
|
124 | $imported += $this->importSingleBundleTranslationFiles($importCommand); |
|
125 | } catch (TranslationsNotFoundException $e) { |
|
126 | continue; |
|
127 | } |
|
128 | } |
|
129 | ||
130 | return $imported; |
|
131 | } |
|
132 | ||
133 | /** |
|
134 | * Import all translation files from your own registered bundles (in src/ directory) |
|
@@ 167-182 (lines=16) @@ | ||
164 | * |
|
165 | * @return int The total number of imported files |
|
166 | */ |
|
167 | private function importCustomBundlesTranslationFiles(ImportCommand $importCommand) |
|
168 | { |
|
169 | $imported = 0; |
|
170 | ||
171 | foreach ($importCommand->getBundles() as $bundle) { |
|
172 | $importCommand->setDefaultBundle(strtolower($bundle)); |
|
173 | ||
174 | try { |
|
175 | $imported += $this->importSingleBundleTranslationFiles($importCommand); |
|
176 | } catch (TranslationsNotFoundException $e) { |
|
177 | continue; |
|
178 | } |
|
179 | } |
|
180 | ||
181 | return $imported; |
|
182 | } |
|
183 | ||
184 | /** |
|
185 | * Import all translation files from a single bundle |