File tree Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -115,29 +115,18 @@ public function toArray()
115115 *
116116 * @return array
117117 */
118- public function toFlat ( $ array = [], $ prefix = '' )
118+ public function toFlat ( $ prefix = '. ' )
119119 {
120- function flatten ( $ array = [], $ prefix = '' , $ default = [] )
121- {
122-
123- $ array = ( count ( $ array ) ) ? $ array : $ default ;
124- $ result = [];
120+ $ results = [];
121+ foreach ( $ this ->strings as $ lang => $ strings ) {
125122
126- foreach ( $ array as $ key => $ value ) {
127- $ new_key = $ prefix . ( empty ( $ prefix ) ? '' : '. ' ) . $ key ;
123+ foreach ( $ strings as $ lang_array => $ lang_messages ) {
128124
129- if ( is_array ( $ value ) ) {
130- $ result = array_merge ( $ result , flatten ( $ value , $ new_key ) );
131- } else {
132- $ result [ $ new_key ] = $ value ;
133- }
125+ $ key = $ lang . $ prefix . $ lang_array ;
126+ $ results [ $ key ] = $ lang_messages ;
134127 }
135-
136- return $ result ;
137128 }
138129
139- $ results = flatten ( $ array , $ prefix , $ this ->strings );
140-
141130 return $ results ;
142131 }
143132
You can’t perform that action at this time.
0 commit comments