5
5
use Helldar \Support \Facades \Helpers \Arr ;
6
6
use Helldar \Support \Facades \Helpers \Filesystem \Directory ;
7
7
use Helldar \Support \Facades \Helpers \Filesystem \File ;
8
- use Helldar \Support \Facades \Helpers \Str ;
9
8
use Helldar \Support \Facades \Tools \Sorter ;
10
9
use LaravelLang \Lang \Concerns \Excludes ;
11
10
use LaravelLang \Lang \Concerns \Template ;
@@ -90,11 +89,9 @@ protected function countMissing(string $locale): int
90
89
return array_sum ($ items );
91
90
}
92
91
93
- protected function getLangPath (string $ locale = null ): string
92
+ protected function getLocalePath (string $ locale = null ): string
94
93
{
95
- $ locale = $ this ->app ->cleanPath ($ locale );
96
-
97
- return $ this ->app ->path ('src/ ' . $ locale );
94
+ return $ this ->app ->localePath ($ locale );
98
95
}
99
96
100
97
protected function getFileBasename (string $ filename ): string
@@ -111,7 +108,7 @@ protected function getCorrectedFilename(string $filename, string $locale): strin
111
108
112
109
protected function locales (): array
113
110
{
114
- return Directory::names ($ this ->getLangPath ());
111
+ return Directory::names ($ this ->getLocalePath ());
115
112
}
116
113
117
114
protected function files (): array
@@ -122,12 +119,12 @@ protected function files(): array
122
119
123
120
$ files = File::names ($ this ->getSourcePath ());
124
121
125
- return $ this ->source_files = Arr::sort ($ files , static function (string $ a , string $ b ) {
122
+ return $ this ->source_files = Arr::sort ($ files , function (string $ a , string $ b ) {
126
123
if ($ a === $ b ) {
127
124
return 0 ;
128
125
}
129
126
130
- if (Str:: endsWith ($ a, ' .json ' )) {
127
+ if ($ this -> isJson ($ a )) {
131
128
return 1 ;
132
129
}
133
130
@@ -139,9 +136,9 @@ protected function files(): array
139
136
140
137
protected function target (string $ locale , string $ filename ): array
141
138
{
142
- $ path = $ this ->isJson ($ filename)
143
- ? $ this -> app -> path ( ' json/ ' . $ filename )
144
- : $ this ->app -> path ( ' src/ ' . $ locale . '/ ' . $ filename );
139
+ $ corrected = $ this ->getCorrectedFilename ($ filename, $ locale );
140
+
141
+ $ path = $ this ->getLocalePath ( $ locale . '/ ' . $ corrected );
145
142
146
143
return $ this ->load ($ path );
147
144
}
0 commit comments