This repository was archived by the owner on Jul 16, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-17
lines changed Expand file tree Collapse file tree 2 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -45,19 +45,29 @@ private function allocateLocaleArray($path)
4545 if (!$ fileinfo ->isDot ()) {
4646 $ noExt = $ this ->removeExtension ($ fileinfo ->getFilename ());
4747 $ tmp = include ($ path . '/ ' . $ fileinfo ->getFilename ());
48- $ res = [];
4948
50- foreach ($ tmp as $ key => $ val ) {
51- $ res [$ key ] = $ this ->adjustString ($ val );
52- }
53-
54- $ data [$ noExt ] = $ res ;
49+ $ data [$ noExt ] = $ this ->adjustArray ($ tmp );
5550 }
5651 }
5752
5853 return $ data ;
5954 }
6055
56+ private function adjustArray (array $ arr )
57+ {
58+ $ res = [];
59+
60+ foreach ($ arr as $ key => $ val ) {
61+ if (is_string ($ val )) {
62+ $ res [$ key ] = $ this ->adjustString ($ val );
63+ } else {
64+ $ res [$ key ] = $ this ->adjustArray ($ val );
65+ }
66+ }
67+
68+ return $ res ;
69+ }
70+
6171 /**
6272 * Turn Laravel style ":link" into vue-i18n style "{link}"
6373 * @param string $s
Original file line number Diff line number Diff line change @@ -94,11 +94,9 @@ function testNamed()
9494 'en ' => [
9595 'help ' => [
9696 'yes ' => 'see :link y :lonk ' ,
97- ]
98- ],
99- 'sv ' => [
100- 'help ' => [
101- 'yes ' => 'se :lonk a :link ' ,
97+ 'no ' => [
98+ 'one ' => 'see :link ' ,
99+ ]
102100 ]
103101 ]
104102 ];
@@ -109,12 +107,10 @@ function testNamed()
109107 'export default { ' . PHP_EOL
110108 . ' "en": { ' . PHP_EOL
111109 . ' "help": { ' . PHP_EOL
112- . ' "yes": "see {link} y {lonk}" ' . PHP_EOL
113- . ' } ' . PHP_EOL
114- . ' }, ' . PHP_EOL
115- . ' "sv": { ' . PHP_EOL
116- . ' "help": { ' . PHP_EOL
117- . ' "yes": "se {lonk} a {link}" ' . PHP_EOL
110+ . ' "yes": "see {link} y {lonk}", ' . PHP_EOL
111+ . ' "no": { ' . PHP_EOL
112+ . ' "one": "see {link}" ' . PHP_EOL
113+ . ' } ' . PHP_EOL
118114 . ' } ' . PHP_EOL
119115 . ' } ' . PHP_EOL
120116 . '} ' . PHP_EOL ,
You can’t perform that action at this time.
0 commit comments