diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/create-random-tasks.php | 26 | ||||
-rwxr-xr-x | scripts/sync-locales.php | 43 |
2 files changed, 69 insertions, 0 deletions
diff --git a/scripts/create-random-tasks.php b/scripts/create-random-tasks.php new file mode 100755 index 00000000..4d665178 --- /dev/null +++ b/scripts/create-random-tasks.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +<?php + +require __DIR__.'/../app/common.php'; + +use Model\Task; + +$task_per_column = 250; +$taskModel = new Task($registry); + +foreach (array(1, 2, 3, 4) as $column_id) { + + for ($i = 1; $i <= $task_per_column; $i++) { + + $task = array( + 'title' => 'Task #'.$i.'-'.$column_id, + 'project_id' => 1, + 'column_id' => $column_id, + 'owner_id' => rand(0, 1), + 'color_id' => rand(0, 1) === 0 ? 'green' : 'purple', + 'score' => rand(0, 21), + ); + + $taskModel->create($task); + } +} diff --git a/scripts/sync-locales.php b/scripts/sync-locales.php new file mode 100755 index 00000000..00d6c897 --- /dev/null +++ b/scripts/sync-locales.php @@ -0,0 +1,43 @@ +#!/usr/bin/env php +<?php + +$reference_lang = 'fr_FR'; +$reference_file = 'app/Locales/'.$reference_lang.'/translations.php'; +$reference = include $reference_file; + + +function update_missing_locales(array $reference, $outdated_file) +{ + $outdated = include $outdated_file; + + $output = '<?php'.PHP_EOL.PHP_EOL; + $output .= 'return array('.PHP_EOL; + + foreach ($reference as $key => $value) { + + if (isset($outdated[$key])) { + //$output .= " '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $value)."',\n"; + $output .= " '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $outdated[$key])."',\n"; + } + else { + //$output .= " // '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $value)."',\n"; + $output .= " // '".str_replace("'", "\'", $key)."' => '',\n"; + } + } + + $output .= ");\n"; + return $output; +} + + +foreach (new DirectoryIterator('app/Locales') as $fileInfo) { + + if (! $fileInfo->isDot() && $fileInfo->isDir() && $fileInfo->getFilename() !== $reference_lang) { + + $filename = 'app/Locales/'.$fileInfo->getFilename().'/translations.php'; + + echo $fileInfo->getFilename().' ('.$filename.')'.PHP_EOL; + + file_put_contents($filename, update_missing_locales($reference, $filename)); + } +} |