File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6060 case 'convert ' :
6161
6262 include ($ file );
63- $ encoded = json_format (convert ($ lang ));
64- file_put_contents ($ fileWithoutExt . '.definition.json ' , $ encoded );
63+ $ definition = json_format (convert_definition ($ lang ));
64+ $ translation = json_format (convert_translation ($ lang )) . "\n" ;
65+ file_put_contents ($ fileWithoutExt . '.definition.json ' , $ definition );
66+ file_put_contents ($ fileWithoutExt . '.translation.json ' , $ translation );
6567 break ;
6668
6769
@@ -74,14 +76,21 @@ function ssp_readline($prompt = '') {
7476 return rtrim ( fgets ( STDIN ), "\n" );
7577}
7678
77- function convert ($ data ) {
79+ function convert_definition ($ data ) {
7880 $ new = array ();
7981 foreach ($ data AS $ key => $ value ) {
8082 $ new [$ key ] = array ('en ' => $ value ['en ' ]);
8183 }
8284 return $ new ;
8385}
8486
87+ function convert_translation ($ data ) {
88+ foreach ($ data as &$ value ) {
89+ unset($ value ['en ' ]);
90+ }
91+ return $ data ;
92+ }
93+
8594function push ($ file , $ fileWithoutExt , $ aid ) {
8695
8796 if (!file_exists ($ file )) throw new Exception ('Could not find file: ' . $ file );
You can’t perform that action at this time.
0 commit comments