File tree 2 files changed +32
-1
lines changed
2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,13 @@ public function generate( $args, $assoc_args = [] ) {
107
107
if ( isset ( $ assoc_args ['verbose ' ] ) ) {
108
108
WP_CLI ::log ( sprintf ( 'Extracting strings from %s ' , $ file_path ) );
109
109
}
110
- $ translations ->addFromWPCodeFile ( $ file_path );
110
+
111
+ if (stristr ($ file_path , '.blade.php ' ) !== false ) {
112
+ $ translations ->addFromWPCodeBladeFile ( $ file_path );
113
+ } else {
114
+ $ translations ->addFromWPCodeFile ( $ file_path );
115
+ }
116
+
111
117
$ progress ->tick ();
112
118
}
113
119
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Gettext \Extractors ;
4
+
5
+ use Gettext \Extractors \WPCode ;
6
+ use Gettext \Translations ;
7
+ use Illuminate \Filesystem \Filesystem ;
8
+ use Illuminate \View \Compilers \BladeCompiler ;
9
+
10
+ class WPCodeBlade extends WPCode implements ExtractorInterface {
11
+
12
+ public static function fromString ( $ string , Translations $ translations , array $ options = [] ) {
13
+
14
+ if (empty ($ options ['facade ' ])) {
15
+ $ cachePath = empty ($ options ['cachePath ' ]) ? sys_get_temp_dir () : $ options ['cachePath ' ];
16
+ $ bladeCompiler = new BladeCompiler (new Filesystem (), $ cachePath );
17
+ $ string = $ bladeCompiler ->compileString ($ string );
18
+ } else {
19
+ $ string = $ options ['facade ' ]::compileString ($ string );
20
+ }
21
+
22
+ parent ::fromString ($ string , $ translations , $ options );
23
+ }
24
+
25
+ }
You can’t perform that action at this time.
0 commit comments