Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon committed Sep 9, 2019
2 parents 28fa0f0 + 5e0364e commit 6b02f53
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Drivers/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function getSingleTranslationsFor($language)
return strpos($file, "{$language}.json");
})->flatMap(function ($file) {
if (strpos($file->getPathname(), 'vendor')) {
$vendor = str_before(Str::after($file->getPathname(), 'vendor'.DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR);
$vendor = Str::before(Str::after($file->getPathname(), 'vendor'.DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR);

return ["{$vendor}::single" => new Collection(json_decode($this->disk->get($file), true))];
}
Expand All @@ -195,7 +195,7 @@ public function getGroupTranslationsFor($language)
// here we check if the path contains 'vendor' as these will be the
// files which need namespacing
if (Str::contains($group->getPathname(), 'vendor')) {
$vendor = str_before(Str::after($group->getPathname(), 'vendor'.DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR);
$vendor = Str::before(Str::after($group->getPathname(), 'vendor'.DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR);

return ["{$vendor}::{$group->getBasename('.php')}" => new Collection(Arr::dot($this->disk->getRequire($group->getPathname())))];
}
Expand All @@ -213,7 +213,7 @@ public function getGroupTranslationsFor($language)
*/
public function getTranslationsForFile($language, $file)
{
$file = str_finish($file, '.php');
$file = Str::finish($file, '.php');
$filePath = "{$this->languageFilesPath}".DIRECTORY_SEPARATOR."{$language}".DIRECTORY_SEPARATOR."{$file}";
$translations = [];

Expand Down Expand Up @@ -298,7 +298,7 @@ private function saveNamespacedGroupTranslations($language, $group, $translation
private function saveSingleTranslations($language, $translations)
{
foreach ($translations as $group => $translation) {
$vendor = str_before($group, '::single');
$vendor = Str::before($group, '::single');
$languageFilePath = $vendor !== 'single' ? 'vendor'.DIRECTORY_SEPARATOR."{$vendor}".DIRECTORY_SEPARATOR."{$language}.json" : "{$language}.json";
$this->disk->put(
"{$this->languageFilesPath}".DIRECTORY_SEPARATOR."{$languageFilePath}",
Expand Down Expand Up @@ -333,7 +333,7 @@ public function getGroupsFor($language)
{
return $this->getGroupFilesFor($language)->map(function ($file) {
if (Str::contains($file->getPathname(), 'vendor')) {
$vendor = str_before(Str::after($file->getPathname(), 'vendor'.DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR);
$vendor = Str::before(Str::after($file->getPathname(), 'vendor'.DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR);

return "{$vendor}::{$file->getBasename('.php')}";
}
Expand Down

0 comments on commit 6b02f53

Please sign in to comment.