generated from fidum/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
translation-linter.php
196 lines (184 loc) · 7.26 KB
/
translation-linter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<?php
return [
'application' => [
/*
|--------------------------------------------------------------------------
| Application Directories
|--------------------------------------------------------------------------
|
| The following array lists the "directories" that will be scanned
| for translations. The defaults below should cover most uses
| but if you need to add more make sure they are absolute paths.
|
*/
'directories' => [
app_path(),
resource_path(),
],
/*
|--------------------------------------------------------------------------
| Application File Extensions
|--------------------------------------------------------------------------
|
| The following array lists the file "extensions" that will be scanned for
| translations. Make sure that all files where you use translations are
| included here.
|
*/
'extensions' => [
'php',
'js',
'vue',
],
],
'lang' => [
/*
|--------------------------------------------------------------------------
| Language Functions
|--------------------------------------------------------------------------
|
| The following array lists the translation "functions" that will be used
| to find translation usage throughout your code. This is injected into
| a regex pattern we use internally.
|
*/
'functions' => [
'__',
'_t',
'@lang',
'@choice',
'trans',
'trans_choice',
'Lang::choice',
'Lang::get',
'Lang::has',
],
/*
|--------------------------------------------------------------------------
| Language File Readers
|--------------------------------------------------------------------------
|
| The following array lists the language file "readers" that will extract
| the translations from your language files. This should be mapped as a
| key value array. The key should be the "extension" and the value
| should be the "Reader" class that implements the required interface.
|
| If you want to disable reading a specific file type then you can
| remove it from the array below.
|
*/
'readers' => [
'json' => \Fidum\LaravelTranslationLinter\Readers\JsonFileReader::class,
'php' => \Fidum\LaravelTranslationLinter\Readers\PhpFileReader::class,
],
],
'missing' => [
/*
|--------------------------------------------------------------------------
| Baseline File
|--------------------------------------------------------------------------
|
| This is the location of the baseline file that is used to ignore specific
| translation keys. You can generate this file by using the `--generate-baseline`
| option when running the command. You should commit this file.
|
*/
'baseline' => lang_path('.lint/missing.json'),
/*
|--------------------------------------------------------------------------
| Output Fields
|--------------------------------------------------------------------------
|
| The following array lists the "fields" that are displayed by the command
| when missing translations are found. Set any of these to `false` to hide
| them from the output or change all to `false` to not show anything.
|
*/
'fields' => [
'locale' => true,
'key' => true,
'file' => true,
],
/*
|--------------------------------------------------------------------------
| Missing Language Filters
|--------------------------------------------------------------------------
|
| The following array lists the "filters" that will be used to filter out
| erroneously detected missing translations.
|
| All filters must implement the filter interface or they will be skipped:
| \Fidum\LaravelTranslationLinter\Contracts\Filter
|
*/
'filters' => [],
/*
|--------------------------------------------------------------------------
| Language Locales
|--------------------------------------------------------------------------
|
| The following array contains the "locales" to use when finding all of
| your registered language files.
|
*/
'locales' => [env('LOCALE_DEFAULT', 'en')],
],
'unused' => [
/*
|--------------------------------------------------------------------------
| Baseline File
|--------------------------------------------------------------------------
|
| This is the location of the baseline file that is used to ignore specific
| translation keys. You can generate this file by using the `--generate-baseline`
| option when running the command. You should commit this file.
|
*/
'baseline' => lang_path('.lint/unused.json'),
/*
|--------------------------------------------------------------------------
| Output Fields
|--------------------------------------------------------------------------
|
| The following array lists the "fields" that are displayed by the command
| when unused translations are found. Set any of these to `false` to hide
| them from the output or change all to `false` to not show anything.
|
*/
'fields' => [
'locale' => true,
'key' => true,
'value' => true,
],
/*
|--------------------------------------------------------------------------
| Unused Language Filters
|--------------------------------------------------------------------------
|
| The following array lists the "filters" that will be used to filter out
| erroneously detected unused translations. For example, you may want to
| ignore default laravel or vendor translations.
|
| All filters must implement the filter interface or they will be skipped:
| \Fidum\LaravelTranslationLinter\Contracts\Filter
|
| We have included some filters with this package which may be of use.
|
*/
'filters' => [
\Fidum\LaravelTranslationLinter\Filters\IgnoreDefaultLanguageFilesFilter::class,
\Fidum\LaravelTranslationLinter\Filters\IgnoreNamespacedKeysFilter::class,
\Fidum\LaravelTranslationLinter\Filters\IgnoreVendorKeysFilter::class,
],
/*
|--------------------------------------------------------------------------
| Language Locales
|--------------------------------------------------------------------------
|
| The following array contains the "locales" to use when finding all of
| your registered language files.
|
*/
'locales' => [env('LOCALE_DEFAULT', 'en')],
],
];