]> source.dussan.org Git - sonarqube.git/commitdiff
fix translatations on the measures page
authorStas Vilchik <vilchiks@gmail.com>
Thu, 7 Jan 2016 08:20:00 +0000 (09:20 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Thu, 7 Jan 2016 08:20:00 +0000 (09:20 +0100)
server/sonar-web/src/main/js/apps/measures/app.js
server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js
server/sonar-web/src/main/js/components/navigator/filters/range-filters.js
server/sonar-web/src/main/js/components/navigator/templates/favorite-details-filter.hbs
server/sonar-web/src/main/js/components/navigator/templates/favorite-filter.hbs
server/sonar-web/src/main/js/components/navigator/templates/metric-filter.hbs
server/sonar-web/src/main/js/components/navigator/templates/range-filter.hbs
server/sonar-web/src/main/js/helpers/handlebars/translate.js [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb

index ebba0f442467d3b5825b5c540fcd2fe330b641f6..3e5d8986caa421841e37e3eb3c40de77ad0c35d0 100644 (file)
@@ -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,
index 30d070a4196583c51e61b9aebfb90d91c20b97c1..fa97b28bde3149406a0b0c200a4e0f7b9522692f 100644 (file)
@@ -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;
   },
index e556e6a8392a393aa6ae557d71a23ecc8a6658c6..17760c4821ed026d14709234d4255272f6b307be 100644 (file)
@@ -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')
     }
   }
 
index 2af8f2fc3b5673a11b9ee5f475b445d296ac0955..f4c24eec9dc366c7df744380607b965cbcab137a 100644 (file)
@@ -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>
index 52e00b0692fce7f7d9888eb245f0d6a3518c852a..ee2a47af93de76fa4e24c5145a243f3f26566cf9 100644 (file)
@@ -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>
index 2da85df1c8672fef9c75637f67aa890edbdb7152..f1c46f053e9876f17d57596149a69fdb84272d55 100644 (file)
@@ -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}}
index a13fdff92e17a9d8bfd9a5d702ce8c3c4f190f64..dc84464e711b552be01e03dac3c37a4a7ee694b1 100644 (file)
@@ -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 (file)
index 0414b84..0000000
+++ /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);
-};
index f9cedf7d9ac891834905bd4873b9359eb6252a88..fff811989ea8f17e979f6fd16f5c9cd13714b1b0 100644 (file)
         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') -%>'
-        }
       }
     });