From 84e3b91199ee2398786b531a077b54af72e9c24a Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Fri, 26 Feb 2021 13:49:07 +0000 Subject: [PATCH] - quickfixes --- src/I18n.php | 2 ++ src/Reader/PhpReader.php | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/I18n.php b/src/I18n.php index 00c9e55..004e4f4 100644 --- a/src/I18n.php +++ b/src/I18n.php @@ -31,6 +31,8 @@ class I18n implements MissingKeyInterface $this->dataReader = $dataReader; $this->cacheReader = $cacheReader; $this->missingKey = $missingKey; + + $this->locale = \Locale::getDefault() ?: $this->locale; } public function initialize(bool $useCache) : bool diff --git a/src/Reader/PhpReader.php b/src/Reader/PhpReader.php index 5ed5f83..ee16626 100644 --- a/src/Reader/PhpReader.php +++ b/src/Reader/PhpReader.php @@ -39,6 +39,11 @@ class PhpReader implements ReaderInterface { public function save(string $filepath, array $content) : bool { $path = $this->pathList[0]; - return (bool) file_put_contents($path . DIRECTORY_SEPARATOR . "$filepath." . $this->accept[0], "return " . var_export($content, true) . ";"); + + if ( ! file_exists($path) ) { + mkdir($path, '0775', true); + } + + return (bool) file_put_contents($path . DIRECTORY_SEPARATOR . "$filepath." . $this->accept[0], "