Skip to content
Snippets Groups Projects
Commit 3eea75f1 authored by Olav Morken's avatar Olav Morken
Browse files

bin/translate: Convert translation file.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2120 44740490-163a-0410-bde0-09ae8108e29a
parent dc0928a4
No related branches found
No related tags found
No related merge requests found
......@@ -60,8 +60,10 @@ switch($action) {
case 'convert':
include($file);
$encoded = json_format(convert($lang));
file_put_contents($fileWithoutExt . '.definition.json' , $encoded);
$definition = json_format(convert_definition($lang));
$translation = json_format(convert_translation($lang)) . "\n";
file_put_contents($fileWithoutExt . '.definition.json' , $definition);
file_put_contents($fileWithoutExt . '.translation.json' , $translation);
break;
......@@ -74,7 +76,7 @@ function ssp_readline($prompt = '') {
return rtrim( fgets( STDIN ), "\n" );
}
function convert($data) {
function convert_definition($data) {
$new = array();
foreach($data AS $key => $value) {
$new[$key] = array('en' => $value['en']);
......@@ -82,6 +84,13 @@ function convert($data) {
return $new;
}
function convert_translation($data) {
foreach ($data as &$value) {
unset($value['en']);
}
return $data;
}
function push($file, $fileWithoutExt, $aid) {
if (!file_exists($file)) throw new Exception('Could not find file: ' . $file);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment