Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#44 - Should handle resources/views/vendor/$package/ and resources/lang/vendor/$package/lang.json #58

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Api/StichozaApiTranslate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
}
}
}
2 changes: 1 addition & 1 deletion src/TranslationFileTranslators/JsonArrayFileTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/TranslationFileTranslators/PhpArrayFileTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Laravel</title>

</head>

<body>
<div class="flex-center position-ref full-height">
<div class="content">
<div class="title m-b-md">
Laravel <br>
{{ __('This is a mail template layout') }}
</div>

<div class="links">
<a href="https://laravel.com/docs">{{ __('Hello World') }}</a>
<a href="https://laracasts.com">@trans('Hi There')</a>
<a href="https://laravel-news.com">News</a>
<a href="https://blog.laravel.com">Blog</a>
<a href="https://nova.laravel.com">Nova</a>
<a href="https://forge.laravel.com">Forge</a>
<a href="https://github.com/laravel/laravel">GitHub</a>
</div>
</div>
</div>
</body>

</html>