diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-05-13 11:57:38 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-05-13 11:57:38 +0200 |
commit | 2715a0716e230a7cf92d6d4414af99ad98d7830c (patch) | |
tree | 180cf3b407146f27c96ff80bb8227e062d206908 /server | |
parent | 9a74d1aeb8d8bdbcf5c5b2a98fb2b2eefd1414a7 (diff) | |
download | sonarqube-2715a0716e230a7cf92d6d4414af99ad98d7830c.tar.gz sonarqube-2715a0716e230a7cf92d6d4414af99ad98d7830c.zip |
SONAR-7634 Metric names should be localized (#967)
Diffstat (limited to 'server')
32 files changed, 75 insertions, 45 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/components/Search.js b/server/sonar-web/src/main/js/apps/code/components/Search.js index 86044f9de8f..fb373856470 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Search.js +++ b/server/sonar-web/src/main/js/apps/code/components/Search.js @@ -22,7 +22,7 @@ import { connect } from 'react-redux'; import classNames from 'classnames'; import { search, selectCurrent, selectNext, selectPrev } from '../actions'; -import { translateWithParameters } from '../../../helpers/l10n'; +import { translate, translateWithParameters } from '../../../helpers/l10n'; class Search extends Component { componentDidMount () { @@ -78,7 +78,7 @@ class Search extends Component { className={inputClassName} type="search" name="q" - placeholder="Search" + placeholder={translate('search_verb')} maxLength="100" autoComplete="off"/> <div className="note"> diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/bubbleChart/BubbleChart.js b/server/sonar-web/src/main/js/apps/component-measures/components/bubbleChart/BubbleChart.js index 2f51e605e65..bb5e925bc73 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/bubbleChart/BubbleChart.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/bubbleChart/BubbleChart.js @@ -26,6 +26,7 @@ import { getComponentLeaves } from '../../../../api/components'; import { formatMeasure } from '../../../../helpers/measures'; import Workspace from '../../../../components/workspace/main'; import { getComponentUrl } from '../../../../helpers/urls'; +import { getLocalizedMetricName, translateWithParameters } from '../../../../helpers/l10n'; const HEIGHT = 500; const BUBBLES_LIMIT = 500; @@ -168,9 +169,15 @@ export default class BubbleChart extends React.Component { {this.renderBubbleChart()} </div> - <div className="measure-details-bubble-chart-axis x">{this.xMetric.name}</div> - <div className="measure-details-bubble-chart-axis y">{this.yMetric.name}</div> - <div className="measure-details-bubble-chart-axis size">Size: {this.sizeMetric.name}</div> + <div className="measure-details-bubble-chart-axis x"> + {getLocalizedMetricName(this.xMetric)} + </div> + <div className="measure-details-bubble-chart-axis y"> + {getLocalizedMetricName(this.yMetric)} + </div> + <div className="measure-details-bubble-chart-axis size"> + {translateWithParameters('component_measures.legend.size_x', getLocalizedMetricName(this.sizeMetric))} + </div> </div> ); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetailsHeader.js b/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetailsHeader.js index bc0d5a5f31b..67063af2737 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetailsHeader.js +++ b/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetailsHeader.js @@ -25,12 +25,13 @@ import LeakPeriodLegend from '../components/LeakPeriodLegend'; import { ComplexityDistribution } from '../../overview/components/complexity-distribution'; import { isDiffMetric, formatLeak } from '../utils'; import { TooltipsContainer } from '../../../components/mixins/tooltips-mixin'; +import { getLocalizedMetricName } from '../../../helpers/l10n'; export default function MeasureDetailsHeader ({ measure, metric, secondaryMeasure, leakPeriod }) { return ( <header className="measure-details-header"> <h2 className="measure-details-metric"> - {metric.name} + {getLocalizedMetricName(metric)} </h2> {isDiffMetric(metric) && ( diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ComponentsList.js b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ComponentsList.js index c9df13a2482..ff6b063441b 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ComponentsList.js +++ b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ComponentsList.js @@ -22,6 +22,7 @@ import React from 'react'; import ComponentsListRow from './ComponentsListRow'; import EmptyComponentsList from './EmptyComponentsList'; import complementary from '../../config/complementary'; +import { getLocalizedMetricName } from '../../../../helpers/l10n'; const ComponentsList = ({ components, metrics, selected, metric, onClick }) => { if (!components.length) { @@ -39,11 +40,11 @@ const ComponentsList = ({ components, metrics, selected, metric, onClick }) => { <tr> <th> </th> <th className="text-right"> - <span className="small">{metric.name}</span> + <span className="small">{getLocalizedMetricName(metric)}</span> </th> {otherMetrics.map(metric => ( <th key={metric.key} className="text-right"> - <span className="small">{metric.name}</span> + <span className="small">{getLocalizedMetricName(metric)}</span> </th> ))} </tr> diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/history/MeasureHistory.js b/server/sonar-web/src/main/js/apps/component-measures/details/history/MeasureHistory.js index 22c72923f43..2370fce1031 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/details/history/MeasureHistory.js +++ b/server/sonar-web/src/main/js/apps/component-measures/details/history/MeasureHistory.js @@ -26,6 +26,7 @@ import Timeline from '../../../../components/charts/Timeline'; import { getTimeMachineData } from '../../../../api/time-machine'; import { getEvents } from '../../../../api/events'; import { formatMeasure, getShortType } from '../../../../helpers/measures'; +import { translate } from '../../../../helpers/l10n'; const HEIGHT = 500; @@ -162,7 +163,7 @@ export default class MeasureHistory extends React.Component { return ( <div className="measure-details-history"> <div className="note text-center" style={{ lineHeight: `${HEIGHT}px` }}> - There is no historical data. + {translate('component_measures.no_history')} </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js b/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js index 7b75d0b65f5..1fe61d36ec9 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js +++ b/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js @@ -24,7 +24,7 @@ import { getLeakValue } from '../../utils'; import { Treemap } from '../../../../components/charts/treemap'; import { getChildren } from '../../../../api/components'; import { formatMeasure } from '../../../../helpers/measures'; -import { translate, translateWithParameters } from '../../../../helpers/l10n'; +import { translate, translateWithParameters, getLocalizedMetricName } from '../../../../helpers/l10n'; import { getComponentUrl } from '../../../../helpers/urls'; import Workspace from '../../../../components/workspace/main'; @@ -93,7 +93,7 @@ export default class MeasureTreemap extends React.Component { const colorMeasure = component.measures[metric.key]; const formatted = colorMeasure != null ? formatMeasure(colorMeasure, metric.type) : '—'; - inner.push(`${metric.name}: ${formatted}`); + inner.push(`${getLocalizedMetricName(metric)}: ${formatted}`); inner = inner.join('<br>'); return `<div class="text-left">${inner}</div>`; @@ -213,7 +213,7 @@ export default class MeasureTreemap extends React.Component { <div className="measure-details-treemap"> <ul className="list-inline note measure-details-treemap-legend"> <li> - {translateWithParameters('component_measures.legend.color_x', metric.name)} + {translateWithParameters('component_measures.legend.color_x', getLocalizedMetricName(metric))} </li> <li> {translateWithParameters('component_measures.legend.size_x', translate('metric.ncloc.name'))} diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasuresDomain.js b/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasuresDomain.js index 8403346f9ec..6f14109c27a 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasuresDomain.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasuresDomain.js @@ -20,6 +20,7 @@ import React from 'react'; import HomeMeasuresList from './HomeMeasuresList'; +import { getLocalizedMetricDomain } from '../../../helpers/l10n'; export default class AllMeasuresDomain extends React.Component { render () { @@ -29,7 +30,9 @@ export default class AllMeasuresDomain extends React.Component { <li> {displayHeader && ( <header className="page-header"> - <h3 className="page-title">{domain.name}</h3> + <h3 className="page-title"> + {getLocalizedMetricDomain(domain.name)} + </h3> </header> )} diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/Home.js b/server/sonar-web/src/main/js/apps/component-measures/home/Home.js index a68619568c1..84b8dabece3 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/Home.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/Home.js @@ -22,7 +22,7 @@ import { Link, IndexLink } from 'react-router'; import LeakPeriodLegend from '../components/LeakPeriodLegend'; import { getLeakPeriod } from '../../../helpers/periods'; -import { translate } from '../../../helpers/l10n'; +import { translate, getLocalizedMetricDomain } from '../../../helpers/l10n'; export default class Home extends React.Component { componentDidMount () { @@ -61,7 +61,7 @@ export default class Home extends React.Component { <Link to={{ pathname: `domain/${domain.name}`, query: { id: component.key } }} activeClassName="active"> - {domain.name} + {getLocalizedMetricDomain(domain.name)} </Link> </li> ))} diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js b/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js index d8eaa2bf8fe..921a24f9f03 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js @@ -23,12 +23,13 @@ import sortBy from 'lodash/sortBy'; import MeasuresList from './MeasuresList'; import { domains } from '../config/domains'; +import { getLocalizedMetricName } from '../../../helpers/l10n'; function sortMeasures (measures, order) { const [known, unknown] = partition(measures, measure => order.includes(measure.metric.key)); return [ ...sortBy(known, measure => order.indexOf(measure.metric.key)), - ...sortBy(unknown, measure => measure.metric.name) + ...sortBy(unknown, measure => getLocalizedMetricName(measure.metric)) ]; } diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/MeasuresList.js b/server/sonar-web/src/main/js/apps/component-measures/home/MeasuresList.js index 9ed099b4924..95a0ac857a8 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/MeasuresList.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/MeasuresList.js @@ -21,6 +21,7 @@ import React from 'react'; import { Link } from 'react-router'; import MeasureListValue from './MeasureListValue'; +import { getLocalizedMetricName } from '../../../helpers/l10n'; const MeasuresList = ({ measures, component, className = 'domain-measures' }) => { return ( @@ -32,7 +33,7 @@ const MeasuresList = ({ measures, component, className = 'domain-measures' }) => <Link to={{ pathname: `metric/${measure.metric.key}`, query: { id: component.key } }}> <div className="domain-measures-name"> <span id={`measure-${measure.metric.key}-name`}> - {measure.metric.name} + {getLocalizedMetricName(measure.metric)} </span> </div> diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/reducer.js b/server/sonar-web/src/main/js/apps/component-measures/home/reducer.js index 9d0cfafb1f5..757889e6860 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/reducer.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/reducer.js @@ -23,6 +23,7 @@ import sortBy from 'lodash/sortBy'; import toPairs from 'lodash/toPairs'; import { RECEIVE_MEASURES } from './actions'; +import { getLocalizedMetricName } from '../../../helpers/l10n'; const initialState = { measures: undefined, @@ -36,7 +37,7 @@ function groupByDomains (measures) { const domains = sortBy(toPairs(groupBy(measures, measure => measure.metric.domain)).map(r => { const [name, measures] = r; - const sortedMeasures = sortBy(measures, measure => measure.metric.name); + const sortedMeasures = sortBy(measures, measure => getLocalizedMetricName(measure.metric)); return { name, measures: sortedMeasures }; }), 'name'); diff --git a/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js index 448922fa23d..bdb039f805a 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js @@ -27,7 +27,7 @@ export default CustomValuesFacet.extend({ prepareSearch () { return this.$('.js-custom-value').select2({ - placeholder: 'Search...', + placeholder: translate('search_verb'), minimumInputLength: 2, allowClear: false, formatNoMatches () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js index 170d96111fa..225d193a241 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js @@ -42,7 +42,7 @@ export default BaseFacet.extend({ prepareSearch () { return this.$('.js-custom-value').select2({ - placeholder: 'Search...', + placeholder: translate('search_verb'), minimumInputLength: 2, allowClear: false, formatNoMatches () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js index 38164faed8f..ab9b6671c0e 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js @@ -28,7 +28,7 @@ export default CustomValuesFacet.extend({ prepareSearch () { return this.$('.js-custom-value').select2({ - placeholder: 'Search...', + placeholder: translate('search_verb'), minimumInputLength: 2, allowClear: false, formatNoMatches () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js index 5b1eaf2bfd0..bc6e193242c 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js @@ -44,7 +44,7 @@ export default CustomValuesFacet.extend({ prepareSearchForViews () { const componentId = this.options.app.state.get('contextComponentUuid'); return this.$('.js-custom-value').select2({ - placeholder: 'Search...', + placeholder: translate('search_verb'), minimumInputLength: 2, allowClear: false, formatNoMatches () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js index 9cd5a702385..343fa489e1c 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js @@ -29,7 +29,7 @@ export default CustomValuesFacet.extend({ url += '&languages=' + languages; } return this.$('.js-custom-value').select2({ - placeholder: 'Search...', + placeholder: translate('search_verb'), minimumInputLength: 2, allowClear: false, formatNoMatches () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js index 1e41af86e4e..6bf0055b685 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js @@ -29,7 +29,7 @@ export default CustomValuesFacet.extend({ url += '&tags=' + tags; } return this.$('.js-custom-value').select2({ - placeholder: 'Search...', + placeholder: translate('search_verb'), minimumInputLength: 0, allowClear: false, formatNoMatches () { diff --git a/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-mode-facet.hbs b/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-mode-facet.hbs index bfbce223cf7..26dc6a0a5ab 100644 --- a/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-mode-facet.hbs +++ b/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-mode-facet.hbs @@ -3,12 +3,12 @@ <li> <input type="radio" name="issues-page-mode" value="count" id="issues-page-mode-count" {{#eq mode 'count'}}checked{{/eq}}> - <label for="issues-page-mode-count">Issues</label> + <label for="issues-page-mode-count">{{t 'issues.facet.mode.issues'}}</label> </li> <li> <input type="radio" name="issues-page-mode" value="effort" id="issues-page-mode-effort" {{#eq mode 'effort'}}checked{{/eq}}> - <label for="issues-page-mode-effort">Effort</label> + <label for="issues-page-mode-effort">{{t 'issues.facet.mode.effort'}}</label> </li> </ul> </div> diff --git a/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-home.hbs b/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-home.hbs index 0057630ed6a..fe32b6b8b21 100644 --- a/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-home.hbs +++ b/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-home.hbs @@ -21,6 +21,6 @@ <div class="big-spacer-top"> or make a - <a href="#resolved=false" class="button spacer-left">New Search</a> + <a href="#resolved=false" class="button spacer-left">{{t 'issues.home.new_search'}}</a> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionForm.js b/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionForm.js index e9cf133c2b0..02722807a43 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionForm.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionForm.js @@ -21,7 +21,7 @@ import _ from 'underscore'; import React from 'react'; import Select from 'react-select'; -import { translate } from '../../../helpers/l10n'; +import { translate, getLocalizedMetricName, getLocalizedMetricDomain } from '../../../helpers/l10n'; export default function AddConditionForm ({ metrics, onSelect }) { function handleChange (option) { @@ -36,7 +36,7 @@ export default function AddConditionForm ({ metrics, onSelect }) { const options = sortedMetrics.map(metric => { return { value: metric.key, - label: metric.name, + label: getLocalizedMetricName(metric), domain: metric.domain }; }); @@ -48,7 +48,7 @@ export default function AddConditionForm ({ metrics, onSelect }) { if (!previous || previous.domain !== option.domain) { optionsWithDomains.push({ value: option.domain, - label: option.domain, + label: getLocalizedMetricDomain(option.domain), disabled: true }); } diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js index 0e91e67d440..385bf06fc2e 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js @@ -23,7 +23,7 @@ import Select from 'react-select'; import DeleteConditionView from '../views/gate-conditions-delete-view'; import Checkbox from '../../../components/shared/checkbox'; import { createCondition, updateCondition } from '../../../api/quality-gates'; -import { translate } from '../../../helpers/l10n'; +import { translate, getLocalizedMetricName } from '../../../helpers/l10n'; import { formatMeasure } from '../../../helpers/measures'; export default class Condition extends Component { @@ -162,7 +162,7 @@ export default class Condition extends Component { return ( <tr> <td className="text-middle nowrap"> - {metric.name} + {getLocalizedMetricName(metric)} {metric.hidden && ( <span className="text-danger little-spacer-left"> {translate('deprecated')} diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js index 8281bf0541b..50f0244c683 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js @@ -24,7 +24,7 @@ import uniqBy from 'lodash/uniqBy'; import ConditionsAlert from './ConditionsAlert'; import AddConditionForm from './AddConditionForm'; import Condition from './Condition'; -import { translate } from '../../../helpers/l10n'; +import { translate, getLocalizedMetricName } from '../../../helpers/l10n'; function getKey (condition, index) { return condition.id ? condition.id : `new-${index}`; @@ -107,7 +107,7 @@ export default class Conditions extends React.Component { <p>{translate('quality_gates.duplicated_conditions')}</p> <ul className="list-styled spacer-top"> {uniqDuplicates.map(d => ( - <li>{d.metric.name}</li> + <li>{getLocalizedMetricName(d.metric)}</li> ))} </ul> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/templates/quality-gates-condition-delete.hbs b/server/sonar-web/src/main/js/apps/quality-gates/templates/quality-gates-condition-delete.hbs index 221d0380016..5ca1ac2944c 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/templates/quality-gates-condition-delete.hbs +++ b/server/sonar-web/src/main/js/apps/quality-gates/templates/quality-gates-condition-delete.hbs @@ -4,7 +4,7 @@ </div> <div class="modal-body"> <div class="js-modal-messages"></div> - {{tp 'quality_gates.delete_condition.confirm.message' metric.name}} + {{tp 'quality_gates.delete_condition.confirm.message' localizedMetricName}} </div> <div class="modal-foot"> <button id="delete-condition-submit">{{t 'delete'}}</button> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/views/gate-conditions-delete-view.js b/server/sonar-web/src/main/js/apps/quality-gates/views/gate-conditions-delete-view.js index 4c4d8bed312..4df1682a907 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/views/gate-conditions-delete-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/views/gate-conditions-delete-view.js @@ -20,6 +20,7 @@ import ModalForm from '../../../components/common/modal-form'; import Template from '../templates/quality-gates-condition-delete.hbs'; import { deleteCondition } from '../../../api/quality-gates'; +import { getLocalizedMetricName } from '../../../helpers/l10n'; export default ModalForm.extend({ template: Template, @@ -40,7 +41,8 @@ export default ModalForm.extend({ serializeData () { return { - metric: this.options.metric + metric: this.options.metric, + localizedMetricName: getLocalizedMetricName(this.options.metric) }; } }); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profile-comparison.hbs b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profile-comparison.hbs index e34ee3e4d00..e26259b6bad 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profile-comparison.hbs +++ b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profile-comparison.hbs @@ -6,7 +6,7 @@ {{#notEmpty profiles}} <form class="spacer-bottom" id="quality-profile-comparison-form"> - <label class="text-middle" for="quality-profile-comparison-with-key">With</label> + <label class="text-middle" for="quality-profile-comparison-with-key">{{t 'with'}}</label> <select id="quality-profile-comparison-with-key"> {{#each profiles}} <option value="{{key}}" {{#eq key ../comparedWith}}selected{{/eq}}>{{name}}</option> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-intro.hbs b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-intro.hbs index 469fd1078a4..add14e79374 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-intro.hbs +++ b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-intro.hbs @@ -1,5 +1,4 @@ <div class="search-navigator-intro markdown"> - <p>Quality Profiles are collections of rules to apply during an analysis.</p> - <p>For each language there is a default profile. All projects not explicitly assigned to some other profile will be - analyzed with the default.</p> + <p>{{t 'quality_profiles.intro1'}}</p> + <p>{{t 'quality_profiles.intro2'}}</p> </div> diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Search.js b/server/sonar-web/src/main/js/apps/web-api/components/Search.js index ca3ae5e2c4a..5f6caa881b0 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/Search.js +++ b/server/sonar-web/src/main/js/apps/web-api/components/Search.js @@ -53,7 +53,7 @@ export default class Search extends React.Component { className="spacer-left input-large" type="search" value={this.state.query} - placeholder="Search..." + placeholder={translate('search_verb')} onChange={this.handleSearch.bind(this)}/> </div> diff --git a/server/sonar-web/src/main/js/components/SelectList/templates/list.hbs b/server/sonar-web/src/main/js/components/SelectList/templates/list.hbs index 6500857a106..95b602d96af 100644 --- a/server/sonar-web/src/main/js/components/SelectList/templates/list.hbs +++ b/server/sonar-web/src/main/js/components/SelectList/templates/list.hbs @@ -6,7 +6,7 @@ <div class="select-list-search-control"> <form class="search-box"> <span class="search-box-submit button-clean"><i class="icon-search"></i></span> - <input class="search-box-input" type="search" name="q" placeholder="Search" maxlength="100" autocomplete="off"> + <input class="search-box-input" type="search" name="q" placeholder="{{t 'search_verb'}}" maxlength="100" autocomplete="off"> </form> </div> </div> diff --git a/server/sonar-web/src/main/js/components/issue/templates/issue-assign-form.hbs b/server/sonar-web/src/main/js/components/issue/templates/issue-assign-form.hbs index 9509d787163..64d2d0d7166 100644 --- a/server/sonar-web/src/main/js/components/issue/templates/issue-assign-form.hbs +++ b/server/sonar-web/src/main/js/components/issue/templates/issue-assign-form.hbs @@ -2,7 +2,7 @@ <button class="search-box-submit button-clean"> <i class="icon-search-new"></i> </button> - <input class="search-box-input" type="search" placeholder="Search" value="{{query}}"> + <input class="search-box-input" type="search" placeholder="{{t 'search_verb'}}" value="{{query}}"> </div> <ul class="menu"></ul> diff --git a/server/sonar-web/src/main/js/components/issue/templates/issue-tags-form.hbs b/server/sonar-web/src/main/js/components/issue/templates/issue-tags-form.hbs index 9509d787163..64d2d0d7166 100644 --- a/server/sonar-web/src/main/js/components/issue/templates/issue-tags-form.hbs +++ b/server/sonar-web/src/main/js/components/issue/templates/issue-tags-form.hbs @@ -2,7 +2,7 @@ <button class="search-box-submit button-clean"> <i class="icon-search-new"></i> </button> - <input class="search-box-input" type="search" placeholder="Search" value="{{query}}"> + <input class="search-box-input" type="search" placeholder="{{t 'search_verb'}}" value="{{query}}"> </div> <ul class="menu"></ul> diff --git a/server/sonar-web/src/main/js/components/select-list/controls.js b/server/sonar-web/src/main/js/components/select-list/controls.js index 35e6d2456a3..47877eae26e 100644 --- a/server/sonar-web/src/main/js/components/select-list/controls.js +++ b/server/sonar-web/src/main/js/components/select-list/controls.js @@ -20,6 +20,7 @@ import _ from 'underscore'; import React from 'react'; import RadioToggle from '../shared/radio-toggle'; +import { translate } from '../../helpers/l10n'; export default React.createClass({ componentWillMount() { @@ -68,7 +69,7 @@ export default React.createClass({ onChange={this.search} ref="search" type="search" - placeholder="Search" + placeholder={translate('search_verb')} initialValue={this.props.query}/> </div> </div> diff --git a/server/sonar-web/src/main/js/helpers/l10n.js b/server/sonar-web/src/main/js/helpers/l10n.js index 0744ede3acf..4327acd30e6 100644 --- a/server/sonar-web/src/main/js/helpers/l10n.js +++ b/server/sonar-web/src/main/js/helpers/l10n.js @@ -95,3 +95,15 @@ export function getLocalizedDashboardName (baseName) { const l10nLabel = translate(l10nKey); return l10nLabel !== l10nKey ? l10nLabel : baseName; } + +export function getLocalizedMetricName (metric) { + const bundleKey = `metric.${metric.key}.name`; + const fromBundle = translate(bundleKey); + return fromBundle !== bundleKey ? fromBundle : metric.name; +} + +export function getLocalizedMetricDomain (domainName) { + const bundleKey = `metric_domain.${domainName}`; + const fromBundle = translate(bundleKey); + return fromBundle !== bundleKey ? fromBundle : domainName; +} |