aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-01-07 09:20:00 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-01-07 09:20:00 +0100
commita86c930b9b307bb159f293a30e54515fc8d3e305 (patch)
tree6eef9b612a85a084d4a848673fc85fe6e2726378 /server/sonar-web
parentbd60854219d700011b9661727a6ff004b3c21ef0 (diff)
downloadsonarqube-a86c930b9b307bb159f293a30e54515fc8d3e305.tar.gz
sonarqube-a86c930b9b307bb159f293a30e54515fc8d3e305.zip
fix translatations on the measures page
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/apps/measures/app.js29
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js5
-rw-r--r--server/sonar-web/src/main/js/components/navigator/filters/range-filters.js5
-rw-r--r--server/sonar-web/src/main/js/components/navigator/templates/favorite-details-filter.hbs2
-rw-r--r--server/sonar-web/src/main/js/components/navigator/templates/favorite-filter.hbs2
-rw-r--r--server/sonar-web/src/main/js/components/navigator/templates/metric-filter.hbs2
-rw-r--r--server/sonar-web/src/main/js/components/navigator/templates/range-filter.hbs2
-rw-r--r--server/sonar-web/src/main/js/helpers/handlebars/translate.js23
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb32
9 files changed, 25 insertions, 77 deletions
diff --git a/server/sonar-web/src/main/js/apps/measures/app.js b/server/sonar-web/src/main/js/apps/measures/app.js
index ebba0f44246..3e5d8986caa 100644
--- a/server/sonar-web/src/main/js/apps/measures/app.js
+++ b/server/sonar-web/src/main/js/apps/measures/app.js
@@ -28,16 +28,17 @@ import FavoriteFilters from '../../components/navigator/filters/favorite-filters
import RangeFilters from '../../components/navigator/filters/range-filters';
import StringFilterView from '../../components/navigator/filters/string-filters';
import MetricFilterView from '../../components/navigator/filters/metric-filters';
+import { translate } from '../../helpers/l10n';
var NavigatorApp = new Marionette.Application(),
newLastAnalysisFilter = function () {
return new BaseFilters.Filter({
- name: window.SS.phrases.lastAnalysis,
+ name: translate('measure_filter.criteria.last_analysis'),
propertyFrom: 'ageMinDays',
propertyTo: 'ageMaxDays',
type: RangeFilters.RangeFilterView,
- placeholder: window.SS.phrases.days,
+ placeholder: translate('measure_filter.criteria.age.days'),
enabled: false,
optional: true
});
@@ -45,7 +46,7 @@ var NavigatorApp = new Marionette.Application(),
newMetricFilter = function (property) {
return new BaseFilters.Filter({
- name: window.SS.phrases.metric,
+ name: translate('measure_filter.criteria.metric'),
property: property,
type: MetricFilterView,
metrics: window.SS.metrics,
@@ -58,7 +59,7 @@ var NavigatorApp = new Marionette.Application(),
newNameFilter = function () {
return new BaseFilters.Filter({
- name: window.SS.phrases.nameContains,
+ name: translate('measure_filter.name_contains'),
property: 'nameSearch',
type: StringFilterView,
enabled: false,
@@ -68,15 +69,15 @@ var NavigatorApp = new Marionette.Application(),
newAlertFilter = function () {
return new BaseFilters.Filter({
- name: window.SS.phrases.alert,
+ name: translate('measure_filter.criteria.alert'),
property: 'alertLevels[]',
type: ChoiceFilters.ChoiceFilterView,
enabled: false,
optional: true,
choices: {
- 'error': window.SS.phrases.error,
- 'warn': window.SS.phrases.warning,
- 'ok': window.SS.phrases.ok
+ 'error': translate('measure_filter.criteria.alert.error'),
+ 'warn': translate('measure_filter.criteria.alert.warn'),
+ 'ok': translate('measure_filter.criteria.alert.ok')
}
});
},
@@ -101,17 +102,17 @@ var NavigatorApp = new Marionette.Application(),
this.filters.add([
new BaseFilters.Filter({
- name: window.SS.phrases.components,
+ name: translate('measure_filter.criteria.components'),
property: 'qualifiers[]',
type: ChoiceFilters.ChoiceFilterView,
enabled: true,
optional: false,
choices: window.SS.qualifiers,
- defaultValue: window.SS.phrases.any
+ defaultValue: translate('any')
}),
new BaseFilters.Filter({
- name: window.SS.phrases.componentsOf,
+ name: translate('measure_filter.criteria.components_of'),
property: 'base',
type: AjaxSelectFilters.ComponentFilterView,
multiple: false,
@@ -120,7 +121,7 @@ var NavigatorApp = new Marionette.Application(),
}),
new BaseFilters.Filter({
- name: window.SS.phrases.favoritesOnly,
+ name: translate('measure_filter.criteria.only_favorites'),
property: 'onFavourites',
type: CheckboxFilterView,
enabled: false,
@@ -128,7 +129,7 @@ var NavigatorApp = new Marionette.Application(),
}),
new BaseFilters.Filter({
- name: window.SS.phrases.date,
+ name: translate('measure_filter.criteria.date'),
propertyFrom: 'fromDate',
propertyTo: 'toDate',
type: RangeFilters.DateRangeFilterView,
@@ -137,7 +138,7 @@ var NavigatorApp = new Marionette.Application(),
}),
new BaseFilters.Filter({
- name: window.SS.phrases.keyContains,
+ name: translate('measure_filter.criteria.key_contains'),
property: 'keySearch',
type: StringFilterView,
enabled: false,
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js
index 30d070a4196..fa97b28bde3 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js
@@ -21,6 +21,7 @@ import $ from 'jquery';
import _ from 'underscore';
import BaseFilters from './base-filters';
import Template from '../templates/metric-filter.hbs';
+import { translate } from '../../../helpers/l10n';
var DetailsMetricFilterView = BaseFilters.DetailsFilterView.extend({
template: Template,
@@ -91,7 +92,7 @@ var DetailsMetricFilterView = BaseFilters.DetailsFilterView.extend({
var value = this.model.get('value') || {};
this.$('[name=metric]').val(value.metric).select2({
width: '100%',
- placeholder: window.SS.phrases.metric
+ placeholder: translate('measure_filter.criteria.metric')
});
this.$('[name=period]').val(value.period || 0).select2({
width: '100%',
@@ -153,7 +154,7 @@ export default BaseFilters.BaseFilterView.extend({
renderValue: function () {
return this.isDefaultValue() ?
- window.SS.phrases.notSet :
+ translate('measure_filter.criteria.metric.not_set') :
this.model.get('value').metricText + ' ' + this.model.get('value').opText + ' ' +
this.model.get('value').valText;
},
diff --git a/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js
index e556e6a8392..17760c4821e 100644
--- a/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js
+++ b/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js
@@ -21,6 +21,7 @@ import $ from 'jquery';
import _ from 'underscore';
import BaseFilters from './base-filters';
import Template from '../templates/range-filter.hbs';
+import { translate } from '../../../helpers/l10n';
var DetailsRangeFilterView = BaseFilters.DetailsFilterView.extend({
template: Template,
@@ -81,7 +82,7 @@ var RangeFilterView = BaseFilters.BaseFilterView.extend({
var value = _.values(this.model.get('value'));
return value.join(' — ');
} else {
- return window.SS.phrases.any;
+ return translate('any');
}
},
@@ -204,7 +205,7 @@ var DateRangeFilterView = RangeFilterView.extend({
var value = _.values(this.model.get('value'));
return value.join(' — ');
} else {
- return window.SS.phrases.anytime;
+ return translate('anytime')
}
}
diff --git a/server/sonar-web/src/main/js/components/navigator/templates/favorite-details-filter.hbs b/server/sonar-web/src/main/js/components/navigator/templates/favorite-details-filter.hbs
index 2af8f2fc3b5..f4c24eec9dc 100644
--- a/server/sonar-web/src/main/js/components/navigator/templates/favorite-details-filter.hbs
+++ b/server/sonar-web/src/main/js/components/navigator/templates/favorite-details-filter.hbs
@@ -9,6 +9,6 @@
{{/ifNotEmpty}}
<ul class="navigator-filter-select-list">
<li class="manage">
- <label id="manage-favorites">{{translate "manage" }}</label>
+ <label id="manage-favorites">{{t 'manage' }}</label>
</li>
</ul>
diff --git a/server/sonar-web/src/main/js/components/navigator/templates/favorite-filter.hbs b/server/sonar-web/src/main/js/components/navigator/templates/favorite-filter.hbs
index 52e00b0692f..ee2a47af93d 100644
--- a/server/sonar-web/src/main/js/components/navigator/templates/favorite-filter.hbs
+++ b/server/sonar-web/src/main/js/components/navigator/templates/favorite-filter.hbs
@@ -1 +1 @@
-<div class="navigator-filter-favorite-toggle" title="{{translate 'filtersList' }}"></div>
+<div class="navigator-filter-favorite-toggle" title="{{t 'measure_filter.filter_list'}}"></div>
diff --git a/server/sonar-web/src/main/js/components/navigator/templates/metric-filter.hbs b/server/sonar-web/src/main/js/components/navigator/templates/metric-filter.hbs
index 2da85df1c86..f1c46f053e9 100644
--- a/server/sonar-web/src/main/js/components/navigator/templates/metric-filter.hbs
+++ b/server/sonar-web/src/main/js/components/navigator/templates/metric-filter.hbs
@@ -11,7 +11,7 @@
</select>
<select name="period">
- <option value="0">{{translate "value"}}</option>
+ <option value="0">{{t 'value'}}</option>
{{#each periods}}
<option value="{{@key}}">{{this}}</option>
{{/each}}
diff --git a/server/sonar-web/src/main/js/components/navigator/templates/range-filter.hbs b/server/sonar-web/src/main/js/components/navigator/templates/range-filter.hbs
index a13fdff92e1..dc84464e711 100644
--- a/server/sonar-web/src/main/js/components/navigator/templates/range-filter.hbs
+++ b/server/sonar-web/src/main/js/components/navigator/templates/range-filter.hbs
@@ -1,5 +1,5 @@
<div class="navigator-filter-details-inner">
<input class="navigator-filter-range-input" type="text" name="{{propertyFrom}}" placeholder="{{placeholder}}">
- <label>{{translate "to"}}</label>
+ <label>{{t 'to.downcase'}}</label>
<input class="navigator-filter-range-input" type="text" name="{{propertyTo}}" placeholder="{{placeholder}}">
</div>
diff --git a/server/sonar-web/src/main/js/helpers/handlebars/translate.js b/server/sonar-web/src/main/js/helpers/handlebars/translate.js
deleted file mode 100644
index 0414b840b5e..00000000000
--- a/server/sonar-web/src/main/js/helpers/handlebars/translate.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube :: Web
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-module.exports = function () {
- var args = Array.prototype.slice.call(arguments, 0, -1);
- return window.translate.apply(this, args);
-};
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb
index f9cedf7d9ac..fff811989ea 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb
@@ -63,38 +63,6 @@
days: '<%= message('work_duration.x_days') -%>',
hours: '<%= message('work_duration.x_hours') -%>',
minutes: '<%= message('work_duration.x_minutes') -%>'
- },
-
- phrases: {
- 'any': '<%= escape_javascript message('any') -%>',
- 'anytime': '<%= escape_javascript message('anytime') -%>',
- 'all': '<%= escape_javascript message('all') -%>',
- 'manage': '<%= escape_javascript message('manage') -%>',
- 'to': '<%= escape_javascript message('to.downcase') -%>',
- 'value': '<%= escape_javascript message('value') -%>',
- 'components': '<%= escape_javascript message('measure_filter.criteria.components') -%>',
- 'age': '<%= escape_javascript message('measure_filter.criteria.age') -%>',
- 'alert': '<%= escape_javascript message('measure_filter.criteria.alert') -%>',
- 'componentsOf': '<%= escape_javascript message('measure_filter.criteria.components_of') -%>',
- 'date': '<%= escape_javascript message('measure_filter.criteria.date') -%>',
- 'favoritesOnly': '<%= escape_javascript message('measure_filter.criteria.only_favorites') -%>',
- 'keyContains': '<%= escape_javascript message('measure_filter.criteria.key_contains') -%>',
- 'lastAnalysis': '<%= escape_javascript message('measure_filter.criteria.last_analysis') -%>',
- 'metric': '<%= escape_javascript message('measure_filter.criteria.metric') -%>',
- 'notSet': '<%= escape_javascript message('measure_filter.criteria.metric.not_set') -%>',
- 'nameContains': '<%= escape_javascript message('measure_filter.name_contains') -%>',
- 'moreCriteria': '<%= escape_javascript message('measure_filter.more_criteria') -%>',
- 'error': '<%= escape_javascript message('measure_filter.criteria.alert.error') -%>',
- 'warning': '<%= escape_javascript message('measure_filter.criteria.alert.warn') -%>',
- 'ok': '<%= escape_javascript message('measure_filter.criteria.alert.ok') -%>',
- 'days': '<%= escape_javascript message('measure_filter.criteria.age.days') -%>',
- 'filtersList': '<%= escape_javascript message('measure_filter.filter_list') -%>',
-
- 'work_duration': {
- 'x_days': '<%= escape_javascript message('work_duration.x_days') -%>',
- 'x_hours': '<%= escape_javascript message('work_duration.x_hours') -%>',
- 'x_minutes': '<%= escape_javascript message('work_duration.x_minutes') -%>'
- }
}
});