Skip to content

Commit 3eea75f

Browse files
committed
bin/translate: Convert translation file.
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2120 44740490-163a-0410-bde0-09ae8108e29a
1 parent dc0928a commit 3eea75f

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

bin/translation.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@
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+
8594
function push($file, $fileWithoutExt, $aid) {
8695

8796
if (!file_exists($file)) throw new Exception('Could not find file: ' . $file);

0 commit comments

Comments
 (0)