@@ -67,10 +67,11 @@ public function __construct(string $filename)
6767 public function translate (
6868 string $ surface_id ,
6969 string $ translation_file ,
70- string $ fallback_file
70+ string $ fallback_file ,
71+ bool $ skip_hide_on = false
7172 ): void {
7273 $ this ->loadTranslations ($ translation_file , $ fallback_file );
73- $ result = $ this ->recurse ($ this ->openapi , $ surface_id );
74+ $ result = $ this ->recurse ($ this ->openapi , $ surface_id, $ skip_hide_on );
7475
7576 $ this ->logs ['translated ' ] = array_unique ($ this ->logs ['translated ' ]);
7677 $ this ->logs ['fallback ' ] = array_unique ($ this ->logs ['fallback ' ]);
@@ -160,18 +161,18 @@ private function loadTranslations(string $file, string $fallback): void
160161 * searching for strings prepended with TRANSLATE_PREPEND and attempting
161162 * to translate them.
162163 */
163- private function recurse (array $ data , string $ surface_id ): TranslationResult
164+ private function recurse (array $ data , string $ surface_id, bool $ skip_hide_on = false ): TranslationResult
164165 {
165166 $ empty_by_hiding = false ;
166167
167168 foreach ($ data as $ k => $ v ) {
168169 if (is_iterable ($ v )) {
169- if (isset ($ v [self ::HIDE_ON ]) && $ this ->shouldHide ($ v [self ::HIDE_ON ], $ surface_id )) {
170+ if (! $ skip_hide_on && isset ($ v [self ::HIDE_ON ]) && $ this ->shouldHide ($ v [self ::HIDE_ON ], $ surface_id )) {
170171 unset($ data [$ k ]);
171172 $ empty_by_hiding = empty ($ data );
172173 } else {
173174 unset($ v [self ::HIDE_ON ]);
174- $ result = $ this ->recurse ($ v , $ surface_id );
175+ $ result = $ this ->recurse ($ v , $ surface_id, $ skip_hide_on );
175176 if ($ result ->isAllHidden ()) {
176177 unset($ data [$ k ]);
177178 } else {
0 commit comments