|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Helldar\LaravelLangPublisher\Concerns; |
|
4
|
|
|
|
|
5
|
|
|
use Helldar\LaravelLangPublisher\Facades\Path; |
|
6
|
|
|
|
|
7
|
|
|
trait Pathable |
|
8
|
|
|
{ |
|
9
|
|
|
protected function pathSource(string $package, string $locale): string |
|
10
|
|
|
{ |
|
11
|
|
|
$this->log('Retrieving a link to the source directory for the', $package, 'package and the', $locale, 'localization...'); |
|
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
return Path::source($package, $locale); |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
protected function pathTarget(string $locale, bool $is_json = false): string |
|
17
|
|
|
{ |
|
18
|
|
|
$this->log('Retrieving a link to the target directory for the', $locale, '(is json:', $is_json, ') localization...'); |
|
19
|
|
|
|
|
20
|
|
|
return Path::target($locale, $is_json); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
protected function pathTargetFull(string $locale, ?string $filename, bool $is_json = false): string |
|
24
|
|
|
{ |
|
25
|
|
|
$this->log('Retrieving a link to the target file for the', $locale, '(is json:', $is_json, ') localization, filename is ', $filename, '...'); |
|
26
|
|
|
|
|
27
|
|
|
return Path::targetFull($locale, $filename, $is_json); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
protected function pathLocales(string $package, string $locale = null): string |
|
31
|
|
|
{ |
|
32
|
|
|
$this->log('Getting the path to excluding English localization: ' . $locale); |
|
33
|
|
|
|
|
34
|
|
|
return Path::locales($package, $locale); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
protected function pathFilename(string $path): string |
|
38
|
|
|
{ |
|
39
|
|
|
$this->log('Getting file name without extension:', $path); |
|
40
|
|
|
|
|
41
|
|
|
return Path::filename($path); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
protected function pathExtension(string $path): string |
|
45
|
|
|
{ |
|
46
|
|
|
$this->log('Getting file extension:', $path); |
|
47
|
|
|
|
|
48
|
|
|
return Path::extension($path); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|