Skip to content

Commit

Permalink
Exception handling
Browse files Browse the repository at this point in the history
Fixes #697
  • Loading branch information
samgeorges committed Sep 23, 2022
1 parent 8e626f1 commit a24700b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions classes/ThemeScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,16 @@ protected function scanThemeConfigForMessagesInternal(Theme $theme)
return false;
}

$translator = Translator::instance();
$keys = [];

foreach ($config as $locale => $messages) {
if (is_string($messages)) {
// $message is a yaml filename, load the yaml file
$messages = $theme->getConfigArray('translate.'.$locale);
}
$keys = array_merge($keys, array_keys($messages));

if (is_array($messages)) {
$keys = array_merge($keys, array_keys($messages));
}
}

Message::importMessages($keys);
Expand All @@ -125,7 +126,10 @@ protected function scanThemeConfigForMessagesInternal(Theme $theme)
// $message is a yaml filename, load the yaml file
$messages = $theme->getConfigArray('translate.'.$locale);
}
Message::importMessageCodes($messages, $locale);

if (is_array($messages)) {
Message::importMessageCodes($messages, $locale);
}
}
}

Expand Down

0 comments on commit a24700b

Please sign in to comment.