diff --git a/PHPCI/Controller/BuildController.php b/PHPCI/Controller/BuildController.php index a46a094a..98960218 100644 --- a/PHPCI/Controller/BuildController.php +++ b/PHPCI/Controller/BuildController.php @@ -12,6 +12,7 @@ namespace PHPCI\Controller; use b8; use b8\Exception\HttpException\NotFoundException; use PHPCI\BuildFactory; +use PHPCI\Helper\Lang; use PHPCI\Model\Build; use PHPCI\Model\Project; use PHPCI\Service\BuildService; @@ -52,26 +53,26 @@ class BuildController extends \PHPCI\Controller } if (empty($build)) { - throw new NotFoundException('Build with ID: ' . $buildId . ' does not exist.'); + throw new NotFoundException(Lang::get('build_x_not_found', $buildId)); } $this->view->plugins = $this->getUiPlugins(); $this->view->build = $build; $this->view->data = $this->getBuildData($build); - $this->layout->title = 'Build #' . $build->getId(); + $this->layout->title = Lang::get('build_n', $buildId); $this->layout->subtitle = $build->getProjectTitle(); $nav = array( - 'title' => 'Build '.$build->getId(), + 'title' => Lang::get('build_n', $buildId), 'icon' => 'cog', 'links' => array( - 'build/rebuild/' . $build->getId() => 'Rebuild Now', + 'build/rebuild/' . $build->getId() => Lang::get('rebuild_now'), ), ); if ($this->currentUserIsAdmin()) { - $nav['links']['build/delete/' . $build->getId()] = 'Delete Build'; + $nav['links']['build/delete/' . $build->getId()] = Lang::get('delete_build'); } $this->layout->nav = $nav; @@ -142,7 +143,7 @@ class BuildController extends \PHPCI\Controller $copy = BuildFactory::getBuildById($buildId); if (empty($copy)) { - throw new NotFoundException('Build with ID: ' . $buildId . ' does not exist.'); + throw new NotFoundException(Lang::get('build_x_not_found', $buildId)); } $build = $this->buildService->createDuplicateBuild($copy); @@ -161,7 +162,7 @@ class BuildController extends \PHPCI\Controller $build = BuildFactory::getBuildById($buildId); if (empty($build)) { - throw new NotFoundException('Build with ID: ' . $buildId . ' does not exist.'); + throw new NotFoundException(Lang::get('build_x_not_found', $buildId)); } $this->buildService->deleteBuild($build); diff --git a/PHPCI/Helper/Lang.php b/PHPCI/Helper/Lang.php index 084c359b..37e17e6f 100644 --- a/PHPCI/Helper/Lang.php +++ b/PHPCI/Helper/Lang.php @@ -87,4 +87,4 @@ class Lang return $strings; } -} \ No newline at end of file +} diff --git a/PHPCI/Languages/lang.en-gb.php b/PHPCI/Languages/lang.en-gb.php index b1ec16ea..3d96e19a 100644 --- a/PHPCI/Languages/lang.en-gb.php +++ b/PHPCI/Languages/lang.en-gb.php @@ -115,5 +115,55 @@ $strings = array( Services section of your Bitbucket repository.', + // View Build + 'build_x_not_found' => 'Build with ID %d does not exist.', + 'build_n' => 'Build %d', + 'rebuild_now' => 'Rebuild Now', -); \ No newline at end of file + + 'committed_by_x' => 'Committed by %s', + 'commit_id_x' => 'Commit: %s', + + 'chart_display' => 'This chart will display once the build has completed.', + + 'build' => 'Build', + 'lines' => 'Lines', + 'comment_lines' => 'Comment Lines', + 'noncomment_lines' => 'Non-Comment Lines', + 'logical_lines' => 'Logical Lines', + 'lines_of_code' => 'Lines of Code', + 'build_log' => 'Build Log', + 'quality_trend' => 'Quality Trend', + 'phpmd_warnings' => 'PHPMD Warnings', + 'phpcs_warnings' => 'PHPCS Warnings', + 'phpcs_errors' => 'PHPCS Errors', + 'phplint_errors' => 'Lint Errors', + 'phpunit_errors' => 'PHPUnit Errors', + 'phpdoccheck_warnings' => 'Missing Docblocks', + 'issues' => 'Issues', + + 'phpcpd' => 'PHP Copy/Paste Detector', + 'phpcs' => 'PHP Code Sniffer', + 'phpdoccheck' => 'Missing Docblocks', + 'phpmd' => 'PHP Mess Detector', + 'phpspec' => 'PHP Spec', + 'phpunit' => 'PHP Unit', + + 'file' => 'File', + 'line' => 'Line', + 'class' => 'Class', + 'method' => 'Method', + 'message' => 'Message', + 'start' => 'Start', + 'end' => 'End', + 'from' => 'From', + 'to' => 'To', + 'suite' => 'Suite', + 'test' => 'Test', + 'result' => 'Result', + 'ok' => 'OK', + 'took_n_seconds' => 'Took %d seconds', + 'build_created' => 'Build Created', + 'build_started' => 'Build Started', + 'build_finished' => 'Build Finished', +); diff --git a/PHPCI/Languages/lang.en-us.php b/PHPCI/Languages/lang.en-us.php index 558588b5..cb5c0661 100644 --- a/PHPCI/Languages/lang.en-us.php +++ b/PHPCI/Languages/lang.en-us.php @@ -9,4 +9,6 @@ require_once(dirname(__FILE__) . '/lang.en-gb.php'); -if (!isset($strings)) $strings = array('test' => 'test'); \ No newline at end of file +if (!isset($strings)) { + $strings = array('test' => 'test'); +} diff --git a/PHPCI/View/Build/view.phtml b/PHPCI/View/Build/view.phtml index a6ecc6db..1fcb57d8 100644 --- a/PHPCI/View/Build/view.phtml +++ b/PHPCI/View/Build/view.phtml @@ -1,8 +1,9 @@ +

- Committed by getCommitterEmail(); ?> + getCommitterEmail()); ?>

@@ -17,10 +18,10 @@
- Branch: getBranch(); ?> + getBranch()); ?> getCommitId() != 'Manual'): ?> -
Commit ID: getCommitId(); ?>
+
getCommitId()); ?> diff --git a/public/assets/js/build-plugins/loc.js b/public/assets/js/build-plugins/loc.js index f911efe2..b74058bb 100644 --- a/public/assets/js/build-plugins/loc.js +++ b/public/assets/js/build-plugins/loc.js @@ -1,7 +1,7 @@ var locPlugin = ActiveBuild.UiPlugin.extend({ id: 'build-lines-chart', css: 'col-lg-6 col-md-6 col-sm-12 col-xs-12', - title: 'Lines of Code', + title: Lang.get('lines_of_code'), lastData: null, displayOnUpdate: false, rendered: false, @@ -24,7 +24,7 @@ var locPlugin = ActiveBuild.UiPlugin.extend({ }, render: function() { - return $('
').text('This chart will display once the build has completed.'); + return $('
').text(Lang.get('chart_display')); }, onUpdate: function(e) { @@ -44,7 +44,7 @@ var locPlugin = ActiveBuild.UiPlugin.extend({ $('#phploc-lines').empty().animate({height: '275px'}); - var titles = ['Build', 'Lines', 'Comment Lines', 'Non-Comment Lines', 'Logical Lines']; + var titles = [Lang.get('build'), Lang.get('lines'), Lang.get('comment_lines'), Lang.get('noncomment_lines'), Lang.get('logical_lines')]; var data = [titles]; for (var i in builds) { data.push(['#' + builds[i].build_id, parseInt(builds[i].meta_value.LOC), parseInt(builds[i].meta_value.CLOC), parseInt(builds[i].meta_value.NCLOC), parseInt(builds[i].meta_value.LLOC)]); @@ -52,8 +52,8 @@ var locPlugin = ActiveBuild.UiPlugin.extend({ var data = google.visualization.arrayToDataTable(data); var options = { - hAxis: {title: 'Builds'}, - vAxis: {title: 'Lines'}, + hAxis: {title: Lang.get('builds')}, + vAxis: {title: Lang.get('lines')}, backgroundColor: { fill: 'transparent' }, height: 275 }; diff --git a/public/assets/js/build-plugins/log.js b/public/assets/js/build-plugins/log.js index 656f566f..8798e23c 100644 --- a/public/assets/js/build-plugins/log.js +++ b/public/assets/js/build-plugins/log.js @@ -1,7 +1,7 @@ var logPlugin = ActiveBuild.UiPlugin.extend({ id: 'build-log', css: 'col-lg-6 col-md-12 col-sm-12 col-xs-12', - title: 'Build Log', + title: Lang.get('build_log'), init: function(){ this._super(); diff --git a/public/assets/js/build-plugins/phpcpd.js b/public/assets/js/build-plugins/phpcpd.js index fea1e664..c9733678 100644 --- a/public/assets/js/build-plugins/phpcpd.js +++ b/public/assets/js/build-plugins/phpcpd.js @@ -1,7 +1,7 @@ var phpcpdPlugin = ActiveBuild.UiPlugin.extend({ id: 'build-phpcpd', css: 'col-lg-6 col-md-12 col-sm-12 col-xs-12', - title: 'PHP Copy/Paste Detector', + title: Lang.get('phpcpd'), lastData: null, box: true, rendered: false, @@ -26,9 +26,9 @@ var phpcpdPlugin = ActiveBuild.UiPlugin.extend({ return $('' + '' + '' + - ' ' + - ' ' + - ' ' + + ' ' + + ' ' + + ' ' + '' + '
FileStartEnd'+Lang.get('file')+''+Lang.get('start')+''+Lang.get('end')+'
'); @@ -64,10 +64,10 @@ var phpcpdPlugin = ActiveBuild.UiPlugin.extend({ file = '' + file + ''; } - var label = 'From'; + var label = Lang.get('from'); if (i % 2 > 0) { - label = 'To'; + label = Lang.get('to'); } else { rowClass = (rowClass == 'warning' ? 'danger' : 'warning'); diff --git a/public/assets/js/build-plugins/phpcs.js b/public/assets/js/build-plugins/phpcs.js index 860972a3..f3b1fe67 100644 --- a/public/assets/js/build-plugins/phpcs.js +++ b/public/assets/js/build-plugins/phpcs.js @@ -1,7 +1,7 @@ var phpcsPlugin = ActiveBuild.UiPlugin.extend({ id: 'build-phpcs', css: 'col-lg-6 col-md-12 col-sm-12 col-xs-12', - title: 'PHP Code Sniffer', + title: Lang.get('phpcs'), lastData: null, box: true, rendered: false, @@ -25,9 +25,9 @@ var phpcsPlugin = ActiveBuild.UiPlugin.extend({ return $('' + '' + '' + - ' ' + - ' ' + - ' ' + + ' ' + + ' ' + + ' ' + '' + '
FileLineMessage'+Lang.get('file')+''+Lang.get('line')+''+Lang.get('message')+'
'); }, diff --git a/public/assets/js/build-plugins/phpdoccheck.js b/public/assets/js/build-plugins/phpdoccheck.js index fa79064e..7d284617 100644 --- a/public/assets/js/build-plugins/phpdoccheck.js +++ b/public/assets/js/build-plugins/phpdoccheck.js @@ -1,7 +1,7 @@ var phpdoccheckPlugin = ActiveBuild.UiPlugin.extend({ id: 'build-phpdoccheck-warnings', css: 'col-lg-6 col-md-12 col-sm-12 col-xs-12', - title: 'PHP Docblock Checker', + title: Lang.get('phpdoccheck'), lastData: null, displayOnUpdate: false, box: true, @@ -27,10 +27,10 @@ var phpdoccheckPlugin = ActiveBuild.UiPlugin.extend({ return $('' + '' + '' + - ' ' + - ' ' + - ' ' + - ' ' + + ' ' + + ' ' + + ' ' + + ' ' + '' + '
FileLineClassMethod'+Lang.get('file')+''+Lang.get('line')+''+Lang.get('class')+''+Lang.get('method')+'
'); }, diff --git a/public/assets/js/build-plugins/phpmd.js b/public/assets/js/build-plugins/phpmd.js index 8aecac53..57723ba9 100644 --- a/public/assets/js/build-plugins/phpmd.js +++ b/public/assets/js/build-plugins/phpmd.js @@ -1,7 +1,7 @@ var phpmdPlugin = ActiveBuild.UiPlugin.extend({ id: 'build-phpmd-warnings', css: 'col-lg-6 col-md-12 col-sm-12 col-xs-12', - title: 'PHP Mess Detector', + title: Lang.get('phpmd'), lastData: null, displayOnUpdate: false, box: true, @@ -28,10 +28,10 @@ var phpmdPlugin = ActiveBuild.UiPlugin.extend({ return $('' + '' + '' + - ' ' + - ' ' + - ' ' + - ' ' + + ' ' + + ' ' + + ' ' + + ' ' + '' + '
FileStartEndMessage'+Lang.get('file')+''+Lang.get('start')+''+Lang.get('end')+''+Lang.get('message')+'
'); }, diff --git a/public/assets/js/build-plugins/phpspec.js b/public/assets/js/build-plugins/phpspec.js index 619f8a80..da1f494b 100644 --- a/public/assets/js/build-plugins/phpspec.js +++ b/public/assets/js/build-plugins/phpspec.js @@ -1,7 +1,7 @@ var phpspecPlugin = ActiveBuild.UiPlugin.extend({ id: 'build-phpspec-errors', css: 'col-lg-12 col-md-12 col-sm-12 col-xs-12', - title: 'PHPSpec', + title: Lang.get('phpspec'), lastData: null, displayOnUpdate: false, box: true, @@ -28,9 +28,9 @@ var phpspecPlugin = ActiveBuild.UiPlugin.extend({ return $('' + '' + '' + - ' ' + - ' ' + - ' ' + + ' ' + + ' ' + + ' ' + '' + '
SuiteTestResult'+Lang.get('suite')+''+Lang.get('test')+''+Lang.get('result')+'
'); }, @@ -57,8 +57,8 @@ var phpspecPlugin = ActiveBuild.UiPlugin.extend({ var row = $( ''+ ''+test_suite.name+''+ - ''+test_case.name+''+ - ''+(test_case.message?test_case.message:'OK')+''+ + ''+test_case.name+''+ + ''+(test_case.message ? test_case.message : Lang.get('ok'))+''+ '' ); diff --git a/public/assets/js/build-plugins/phpunit.js b/public/assets/js/build-plugins/phpunit.js index cb48159d..0e648e9d 100644 --- a/public/assets/js/build-plugins/phpunit.js +++ b/public/assets/js/build-plugins/phpunit.js @@ -1,7 +1,7 @@ var phpunitPlugin = ActiveBuild.UiPlugin.extend({ id: 'build-phpunit-errors', css: 'col-lg-6 col-md-12 col-sm-12 col-xs-12', - title: 'PHPUnit', + title: Lang.get('phpunit'), lastData: null, displayOnUpdate: false, box: true, @@ -28,7 +28,7 @@ var phpunitPlugin = ActiveBuild.UiPlugin.extend({ return $('' + '' + '' + - ' ' + + ' ' + '' + '
Test'+Lang.get('test')+'
'); }, diff --git a/public/assets/js/build-plugins/time.js b/public/assets/js/build-plugins/time.js index a3ecdecc..15a2dfb1 100644 --- a/public/assets/js/build-plugins/time.js +++ b/public/assets/js/build-plugins/time.js @@ -28,9 +28,9 @@ var timePlugin = ActiveBuild.UiPlugin.extend({ return '' + '' + '' + - '' + - '' + - '' + + '' + + '' + + '' + '' + '' + '' + diff --git a/public/assets/js/build-plugins/warnings.js b/public/assets/js/build-plugins/warnings.js index 8d09d762..eff65839 100644 --- a/public/assets/js/build-plugins/warnings.js +++ b/public/assets/js/build-plugins/warnings.js @@ -1,14 +1,14 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({ id: 'build-warnings-chart', css: 'col-lg-6 col-md-6 col-sm-12 col-xs-12', - title: 'Quality Trend', + title: Lang.get('quality_trend'), keys: { - 'phpmd-warnings': 'PHPMD Warnings', - 'phpcs-warnings': 'PHPCS Warnings', - 'phpcs-errors': 'PHPCS Errors', - 'phplint-errors': 'PHPLint Errors', - 'phpunit-errors': 'PHPUnit Errors', - 'phpdoccheck-warnings': 'PHP Docblock Checker Warnings' + 'phpmd-warnings': Lang.get('phpmd_warnings'), + 'phpcs-warnings': Lang.get('phpcs_warnings'), + 'phpcs-errors': Lang.get('phpcs_errors'), + 'phplint-errors': Lang.get('phplint_errors'), + 'phpunit-errors': Lang.get('phpunit_errors'), + 'phpdoccheck-warnings': Lang.get('phpdoccheck') }, data: {}, displayOnUpdate: false, @@ -39,7 +39,7 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({ }, render: function() { - return $('
').text('This chart will display once the build has completed.'); + return $('
').text(Lang.get('chart_display')); }, onUpdate: function(e) { @@ -91,8 +91,8 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({ var data = google.visualization.arrayToDataTable(data); var options = { - hAxis: {title: 'Builds'}, - vAxis: {title: 'Warnings / Errors'}, + hAxis: {title: Lang.get('builds')}, + vAxis: {title: Lang.get('issues')}, backgroundColor: { fill: 'transparent' }, height: 275, pointSize: 3 diff --git a/public/assets/js/phpci.js b/public/assets/js/phpci.js index 49c7514d..7adf1b30 100644 --- a/public/assets/js/phpci.js +++ b/public/assets/js/phpci.js @@ -484,6 +484,6 @@ var Lang = { return sprintf.apply(sprintf[0], args); } - return ''; + return 'MISSING: ' + string; } }; \ No newline at end of file
Build CreatedBuild StartedBuild Finished'+Lang.get('build_created')+''+Lang.get('build_started')+''+Lang.get('build_finished')+'