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