Skip to content

Commit

Permalink
Do not throw error if no language
Browse files Browse the repository at this point in the history
  • Loading branch information
Bozhidar Hristov committed Aug 4, 2017
1 parent 2c78d47 commit c0e2669
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/CurrentTranslationLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ public function initializeCurrentTranslation(TranslatableInterface $entity)
$translationService = $this->container->get('object_bg.translation.service.translation');
/** @var Language $currentLanguage */
$currentLanguage = $translationService->getCurrentLanguage();
$success = $this->initializeTranslation($entity, $currentLanguage);

$locale = $currentLanguage->getLocale();
$locale = null;
$success = false;

if ($currentLanguage) {
$success = $this->initializeTranslation($entity, $currentLanguage);
$locale = $currentLanguage->getLocale();
}

if ($success == false) {
$locale = $this->initializeFallbackTranslation($entity);
Expand Down

0 comments on commit c0e2669

Please sign in to comment.