Skip to content

Commit

Permalink
Merge pull request #16 from benwrigley/windows-directory-compatible
Browse files Browse the repository at this point in the history
Replace hard-coded path separators with DIRECTORY_SEPARATOR for cross…
  • Loading branch information
mikield authored May 13, 2024
2 parents 5c812e8 + 208a0bc commit e0393e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/TranslationPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ private function phpTranslations(string $locale): array
return collect(File::allFiles($path))->mapWithKeys(function (\SplFileInfo $file) use ($locale) {
$key = str($file->getPathname())
->replace([lang_path(), '.php'], '')
->replace('/'.$locale.'/', '')
->replace(DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR, '')
->toString();
$keyPath = explode('/', $key);
$keyPath = explode(DIRECTORY_SEPARATOR, $key);
$keyPath = array_reverse($keyPath);
return [
str($key)->replace('/', '.')->toString() => trans($key, [], $locale)
str($key)->replace(DIRECTORY_SEPARATOR, '.')->toString() => trans($key, [], $locale)
];
})->undot()->toArray();
}
Expand Down

0 comments on commit e0393e7

Please sign in to comment.