| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 13 | public function createTranslator(array $config, $domain = 'default') |
|
| 17 | { |
||
| 18 | 13 | $translator = new Translator(); |
|
| 19 | |||
| 20 | 13 | foreach ($config['supported_locales'] as $locale) { |
|
| 21 | 13 | $file = $config['translations_dir'] . '/' . $locale . '/' . $locale . '.mo'; |
|
| 22 | 13 | $translator->addTranslationFile( |
|
| 23 | 13 | $config['type'], |
|
| 24 | 13 | $file, |
|
| 25 | 13 | $domain, |
|
| 26 | 13 | $locale |
|
| 27 | ); |
||
| 28 | } |
||
| 29 | 13 | $translator->setLocale(Locale::getDefault()); |
|
| 30 | |||
| 31 | 13 | return $translator; |
|
| 32 | } |
||
| 33 | |||
| 52 | } |