@@ 101-117 (lines=17) @@ | ||
98 | * |
|
99 | * @return int total number of files imported |
|
100 | */ |
|
101 | private function importAllBundlesTranslationFiles(ImportCommand $importCommand) |
|
102 | { |
|
103 | $bundles = array_map('strtolower', array_keys($this->kernel->getBundles())); |
|
104 | $imported = 0; |
|
105 | ||
106 | foreach ($bundles as $bundle) { |
|
107 | $importCommand->setDefaultBundle($bundle); |
|
108 | ||
109 | try { |
|
110 | $imported += $this->importSingleBundleTranslationFiles($importCommand); |
|
111 | } catch (TranslationsNotFoundException $e) { |
|
112 | continue; |
|
113 | } |
|
114 | } |
|
115 | ||
116 | return $imported; |
|
117 | } |
|
118 | ||
119 | /** |
|
120 | * Import all translation files from your own registered bundles (in src/ directory) |
|
@@ 153-168 (lines=16) @@ | ||
150 | * |
|
151 | * @return int The total number of imported files |
|
152 | */ |
|
153 | private function importCustomBundlesTranslationFiles(ImportCommand $importCommand) |
|
154 | { |
|
155 | $imported = 0; |
|
156 | ||
157 | foreach ($importCommand->getBundles() as $bundle) { |
|
158 | $importCommand->setDefaultBundle(strtolower($bundle)); |
|
159 | ||
160 | try { |
|
161 | $imported += $this->importSingleBundleTranslationFiles($importCommand); |
|
162 | } catch (TranslationsNotFoundException $e) { |
|
163 | continue; |
|
164 | } |
|
165 | } |
|
166 | ||
167 | return $imported; |
|
168 | } |
|
169 | ||
170 | /** |
|
171 | * Import all translation files from a single bundle |