File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -173,11 +173,8 @@ public function twigL($label, $lang = false)
173173 /** @var Labels $labels */
174174 $ labels = $ app ['labels ' ];
175175 $ label = $ labels ->cleanLabel ($ label );
176- $ lang = mb_strtolower ($ lang );
176+ $ lang = $ this -> isValidLanguage ( $ lang ) ? mb_strtolower ($ lang) : $ this -> getCurrentLanguage ( );
177177
178- if (!$ this ->isValidLanguage ($ lang )) {
179- $ lang = $ this ->getCurrentLanguage ();
180- }
181178 $ savedLabels = $ labels ->getLabels ();
182179 $ savedLabel = $ savedLabels ->getPath ("$ label/ $ lang " );
183180
@@ -187,7 +184,7 @@ public function twigL($label, $lang = false)
187184 }
188185
189186 // If we're automatically saving new/missing labels, add it to the JSON file
190- if ($ config ->isAddMissing () && !$ savedLabels ->hasItem ($ label )) {
187+ if ($ config ->isAddMissing () && $ this -> isValidLanguage ( $ lang ) && !$ savedLabels ->hasItem ($ label )) {
191188 $ labels ->addLabel ($ label );
192189 }
193190
You can’t perform that action at this time.
0 commit comments