Skip to content

Commit 0e365e1

Browse files
author
hlib
committed
🚚 move: move data from base_path to resource_path for LangService class
1 parent 338031d commit 0e365e1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/LangService.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ public function generateLangsFiles(array $dataArr): void
209209
if ($this->fileType === 'json') {
210210
foreach ($this->languages as $language) {
211211
if (!$this->isNew) {
212-
$dataArr = $this->updateValues(base_path('lang/'.$language.'.json'), $dataArr);
212+
$dataArr = $this->updateValues(resource_path('lang/'.$language.'.json'), $dataArr);
213213
}
214214

215215
if ($this->isSync) {
216216
$dataArr = $this->syncValues($this->translationsKeys, $dataArr);
217217
}
218218

219-
file_put_contents(base_path('lang/'.$language.'.json'), json_encode($dataArr, JSON_THROW_ON_ERROR
219+
file_put_contents(resource_path('lang/'.$language.'.json'), json_encode($dataArr, JSON_THROW_ON_ERROR
220220
| JSON_PRETTY_PRINT));
221221
}
222222
} elseif ($this->fileType === 'array') {
@@ -370,11 +370,11 @@ private function syncValues(array $parsedArr, array $dataArr): array
370370
private function fillKeys($fileName, array $keys): void
371371
{
372372
foreach ($this->languages as $language) {
373-
if (!is_dir(base_path('lang'."/$language")) && !mkdir(base_path('lang'."/$language"), 0777, true)
374-
&& !is_dir(base_path('lang'."/$language"))) {
375-
throw new RuntimeException(sprintf('Directory "%s" was not created', 'path/to/directory'));
373+
if (!is_dir(resource_path('lang'."/$language")) && !mkdir(resource_path('lang'."/$language"), 0777, true)
374+
&& !is_dir(resource_path('lang'."/$language"))) {
375+
throw new RuntimeException(sprintf('Directory "%s" was not created', resource_path('lang'."/$language")));
376376
}
377-
$filePath = base_path('lang'."/$language/$fileName.php");
377+
$filePath = resource_path('lang'."/$language/$fileName.php");
378378

379379
if (!$this->isNew) {
380380
$keys = $this->updateValues($filePath, $keys);

0 commit comments

Comments
 (0)