From 413fab23b15aad828d296d42b8de503f6700c1e8 Mon Sep 17 00:00:00 2001 From: Ruslan Baidan Date: Tue, 10 Oct 2023 12:04:41 +0200 Subject: [PATCH] Fixed the TranslateServiceFactory to use the project root const and avoid returning false. --- src/Service/TranslateServiceFactory.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Service/TranslateServiceFactory.php b/src/Service/TranslateServiceFactory.php index 5cb72674..0276951c 100755 --- a/src/Service/TranslateServiceFactory.php +++ b/src/Service/TranslateServiceFactory.php @@ -24,12 +24,10 @@ class TranslateServiceFactory implements FactoryInterface */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { - if (is_dir('node_modules/ng_client/po')) { - $baseDir = 'node_modules/ng_client/po/'; - } elseif (is_dir('node_modules/ng_backoffice/po')) { - $baseDir = 'node_modules/ng_backoffice/po/'; - } else { - return false; + $projectRoot = \defined('PROJECT_ROOT') ? PROJECT_ROOT : ''; + $baseDir = $projectRoot . 'node_modules/ng_client/po/'; + if (is_dir($projectRoot . 'node_modules/ng_backoffice/po')) { + $baseDir = $projectRoot . 'node_modules/ng_backoffice/po/'; } $transConf = [ 'locale' => '',