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)
45
45
if (!$ fileinfo ->isDot ()) {
46
46
$ noExt = $ this ->removeExtension ($ fileinfo ->getFilename ());
47
47
$ tmp = include ($ path . '/ ' . $ fileinfo ->getFilename ());
48
- $ res = [];
49
48
50
- foreach ($ tmp as $ key => $ val ) {
51
- $ res [$ key ] = $ this ->adjustString ($ val );
52
- }
53
-
54
- $ data [$ noExt ] = $ res ;
49
+ $ data [$ noExt ] = $ this ->adjustArray ($ tmp );
55
50
}
56
51
}
57
52
58
53
return $ data ;
59
54
}
60
55
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
+
61
71
/**
62
72
* Turn Laravel style ":link" into vue-i18n style "{link}"
63
73
* @param string $s
Original file line number Diff line number Diff line change @@ -94,11 +94,9 @@ function testNamed()
94
94
'en ' => [
95
95
'help ' => [
96
96
'yes ' => 'see :link y :lonk ' ,
97
- ]
98
- ],
99
- 'sv ' => [
100
- 'help ' => [
101
- 'yes ' => 'se :lonk a :link ' ,
97
+ 'no ' => [
98
+ 'one ' => 'see :link ' ,
99
+ ]
102
100
]
103
101
]
104
102
];
@@ -109,12 +107,10 @@ function testNamed()
109
107
'export default { ' . PHP_EOL
110
108
. ' "en": { ' . PHP_EOL
111
109
. ' "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
118
114
. ' } ' . PHP_EOL
119
115
. ' } ' . PHP_EOL
120
116
. '} ' . PHP_EOL ,
You can’t perform that action at this time.
0 commit comments