diff --git a/src/Api/StichozaApiTranslate.php b/src/Api/StichozaApiTranslate.php index cf933c6..052380f 100644 --- a/src/Api/StichozaApiTranslate.php +++ b/src/Api/StichozaApiTranslate.php @@ -25,11 +25,11 @@ public function translate(string $text, string $locale, string $base_locale = nu $this->handle->setSource(); else $this->handle->setSource($base_locale); - $this->handle->setTarget($locale); + $this->handle->setTarget($locale); try { - return $this->handle->translate($text); + return $this->handle->translate($text) ?? ""; } catch (\ErrorException $e) { - return false; + return ""; } } } diff --git a/src/TranslationFileTranslators/JsonArrayFileTranslator.php b/src/TranslationFileTranslators/JsonArrayFileTranslator.php index d6a26c3..a60c168 100644 --- a/src/TranslationFileTranslators/JsonArrayFileTranslator.php +++ b/src/TranslationFileTranslators/JsonArrayFileTranslator.php @@ -100,7 +100,7 @@ private function explore_strings() "\k{quote}" . // Match " or ' previously matched "[\),]"; // Close parentheses or new parameter $finder = new Finder(); - $finder->in(base_path())->exclude('storage')->exclude('vendor')->name('*.php')->name('*.twig')->name('*.vue')->files(); + $finder->in(base_path())->exclude('storage')->exclude('vendor')->in(base_path().DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'vendor')->name('*.php')->name('*.twig')->name('*.vue')->files(); /** @var \Symfony\Component\Finder\SplFileInfo $file */ foreach ($finder as $file) { // Search the current file for the pattern diff --git a/src/TranslationFileTranslators/PhpArrayFileTranslator.php b/src/TranslationFileTranslators/PhpArrayFileTranslator.php index f47f9ad..7c5d405 100644 --- a/src/TranslationFileTranslators/PhpArrayFileTranslator.php +++ b/src/TranslationFileTranslators/PhpArrayFileTranslator.php @@ -59,7 +59,7 @@ private function create_missing_target_folders($target_locale, $files) if(Str::contains($file, '/')){ $folder_address = $this->get_language_file_address($target_locale, dirname($file)); if(!is_dir($folder_address)){ - mkdir($folder_address, 0777, true); + mkdir($folder_address, 0775, true); } } } diff --git a/tests/test-resources/resources/views/vendor/mail/html/layout.blade.php b/tests/test-resources/resources/views/vendor/mail/html/layout.blade.php new file mode 100644 index 0000000..20093cb --- /dev/null +++ b/tests/test-resources/resources/views/vendor/mail/html/layout.blade.php @@ -0,0 +1,33 @@ + + + + + + + + Laravel + + + + +
+
+
+ Laravel
+ {{ __('This is a mail template layout') }} +
+ + +
+
+ + +