diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-05-23 15:50:18 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-05-24 10:04:13 +0200 |
commit | ecd2b90b42b8f70d18f8ab6a6fb4353267893c29 (patch) | |
tree | 12b3ac5b8999e856cf1cc0e0f41671ee9b458d35 /server/sonar-web/src/main | |
parent | 84026b6f1c006c925c632449d070076655e8ad51 (diff) | |
download | sonarqube-ecd2b90b42b8f70d18f8ab6a6fb4353267893c29.tar.gz sonarqube-ecd2b90b42b8f70d18f8ab6a6fb4353267893c29.zip |
Fix localization in projects page facets
Diffstat (limited to 'server/sonar-web/src/main')
10 files changed, 29 insertions, 22 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.js index e914a5180cd..c29c7f26ec6 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.js @@ -23,6 +23,7 @@ import FilterHeader from './FilterHeader'; import SortingFilter from './SortingFilter'; import CoverageRating from '../../../components/ui/CoverageRating'; import { getCoverageRatingLabel, getCoverageRatingAverageValue } from '../../../helpers/ratings'; +import { translate } from '../../../helpers/l10n'; export default class CoverageFilter extends React.PureComponent { static propTypes = { @@ -65,7 +66,7 @@ export default class CoverageFilter extends React.PureComponent { getFacetValueForOption={this.getFacetValueForOption} highlightUnder={1} header={ - <FilterHeader name="Coverage"> + <FilterHeader name={translate('metric_domain.Coverage')}> <SortingFilter property={this.property} query={this.props.query} diff --git a/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.js index c1fed7f0723..e6f2304bc2f 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.js @@ -26,6 +26,7 @@ import { getDuplicationsRatingLabel, getDuplicationsRatingAverageValue } from '../../../helpers/ratings'; +import { translate } from '../../../helpers/l10n'; export default class DuplicationsFilter extends React.PureComponent { static propTypes = { @@ -68,7 +69,7 @@ export default class DuplicationsFilter extends React.PureComponent { getFacetValueForOption={this.getFacetValueForOption} highlightUnder={1} header={ - <FilterHeader name="Duplications"> + <FilterHeader name={translate('metric_domain.Duplications')}> <SortingFilter property={this.property} query={this.props.query} diff --git a/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.js index 96e1a2669e2..a287639d59c 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.js @@ -22,6 +22,7 @@ import FilterContainer from './FilterContainer'; import FilterHeader from './FilterHeader'; import SortingFilter from './SortingFilter'; import Rating from '../../../components/ui/Rating'; +import { translate } from '../../../helpers/l10n'; export default class IssuesFilter extends React.PureComponent { static propTypes = { @@ -40,7 +41,9 @@ export default class IssuesFilter extends React.PureComponent { return ( <span> <Rating value={option} small={true} muted={!selected} /> - {option > 1 && option < 5 && <span className="note spacer-left">and worse</span>} + {option > 1 && + option < 5 && + <span className="note spacer-left">{translate('and_worse')}</span>} </span> ); } @@ -57,7 +60,7 @@ export default class IssuesFilter extends React.PureComponent { getFacetValueForOption={this.getFacetValueForOption} highlightUnder={1} header={ - <FilterHeader name={this.props.name}> + <FilterHeader name={translate('metric_domain', this.props.name)}> <SortingFilter property={this.props.property} query={this.props.query} diff --git a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js index 47de2131a8f..4218dbc3f26 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js @@ -25,6 +25,7 @@ import FilterHeader from './FilterHeader'; import SearchableFilterFooter from './SearchableFilterFooter'; import SearchableFilterOption from './SearchableFilterOption'; import { getLanguageByKey } from '../../../store/languages/reducer'; +import { translate } from '../../../helpers/l10n'; type Props = { query: {}, @@ -81,7 +82,7 @@ export default class LanguagesFilter extends React.PureComponent { organization={this.props.organization} getFacetValueForOption={this.getFacetValueForOption} highlightUnder={1} - header={<FilterHeader name="Languages" />} + header={<FilterHeader name={translate('projects.facets.languages')} />} footer={ <SearchableFilterFooter property={this.property} diff --git a/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.js index d40bd4edf2f..0df57464933 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.js @@ -21,6 +21,7 @@ import React from 'react'; import FilterContainer from './FilterContainer'; import FilterHeader from './FilterHeader'; import Level from '../../../components/ui/Level'; +import { translate } from '../../../helpers/l10n'; export default class QualityGateFilter extends React.PureComponent { static propTypes = { @@ -48,7 +49,7 @@ export default class QualityGateFilter extends React.PureComponent { organization={this.props.organization} getFacetValueForOption={this.getFacetValueForOption} highlightUnder={1} - header={<FilterHeader name="Quality Gate" />} + header={<FilterHeader name={translate('projects.facets.quality_gate')} />} /> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.js index d97524f2546..c9cb96b15bc 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.js @@ -81,7 +81,7 @@ export default class SizeFilter extends React.PureComponent { getFacetValueForOption={this.getFacetValueForOption} highlightUnder={1} header={ - <FilterHeader name="Size"> + <FilterHeader name={translate('metric_domain.Size')}> <SortingFilter property={this.property} query={this.props.query} diff --git a/server/sonar-web/src/main/js/apps/projects/filters/SortingFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/SortingFilter.js index ae97c28785e..61f7dfa1262 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/SortingFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/SortingFilter.js @@ -33,10 +33,9 @@ export default class SortingFilter extends React.PureComponent { leftText: React.PropTypes.string, rightText: React.PropTypes.string }; + static defaultProps = { - sortDesc: 'left', - leftText: translate('worst'), - rightText: translate('best') + sortDesc: 'left' }; isSortActive(side) { @@ -78,13 +77,13 @@ export default class SortingFilter extends React.PureComponent { onClick={this.blurLink} className={this.getLinkClass('left')} to={this.getLinkPath('left')}> - {leftText} + {leftText || translate('worst')} </Link> <Link onClick={this.blurLink} className={this.getLinkClass('right')} to={this.getLinkPath('right')}> - {rightText} + {rightText || translate('best')} </Link> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.js index c79b7bf2fb8..05f795cbd50 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.js @@ -25,6 +25,7 @@ import FilterHeader from './FilterHeader'; import SearchableFilterFooter from './SearchableFilterFooter'; import SearchableFilterOption from './SearchableFilterOption'; import { searchProjectTags } from '../../../api/components'; +import { translate } from '../../../helpers/l10n'; type Props = { query: {}, @@ -104,7 +105,7 @@ export default class TagsFilter extends React.PureComponent { organization={this.props.organization} getFacetValueForOption={this.getFacetValueForOption} highlightUnder={1} - header={<FilterHeader name="Tags" />} + header={<FilterHeader name={translate('projects.facets.tags')} />} footer={ <SearchableFilterFooter property={this.property} diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.js.snap b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.js.snap index ce37370ca0f..1605a2de810 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/LanguagesFilter-test.js.snap @@ -77,7 +77,7 @@ exports[`should render maximum 10 languages in the searchbox results 1`] = ` halfWidth={false} header={ <FilterHeader - name="Languages" + name="projects.facets.languages" /> } highlightUnder={1} @@ -157,7 +157,7 @@ exports[`should render the languages facet with the selected languages 1`] = ` halfWidth={false} header={ <FilterHeader - name="Languages" + name="projects.facets.languages" /> } highlightUnder={1} @@ -194,7 +194,7 @@ exports[`should render the languages facet with the selected languages 2`] = ` data-key="languages" > <FilterHeader - name="Languages" + name="projects.facets.languages" /> <div className="search-navigator-facet-list" @@ -379,7 +379,7 @@ exports[`should render the languages without the ones in the facet 1`] = ` halfWidth={false} header={ <FilterHeader - name="Languages" + name="projects.facets.languages" /> } highlightUnder={1} diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/TagsFilter-test.js.snap b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/TagsFilter-test.js.snap index aeaa01f2554..1cadc1ba2e8 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/TagsFilter-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/TagsFilter-test.js.snap @@ -80,7 +80,7 @@ exports[`should render maximum 10 tags in the searchbox results 1`] = ` halfWidth={false} header={ <FilterHeader - name="Tags" + name="projects.facets.tags" /> } highlightUnder={1} @@ -148,7 +148,7 @@ exports[`should render the tags facet with the selected tags 1`] = ` halfWidth={false} header={ <FilterHeader - name="Tags" + name="projects.facets.tags" /> } highlightUnder={1} @@ -185,7 +185,7 @@ exports[`should render the tags facet with the selected tags 2`] = ` data-key="tags" > <FilterHeader - name="Tags" + name="projects.facets.tags" /> <div className="search-navigator-facet-list" @@ -328,7 +328,7 @@ exports[`should render the tags without the ones in the facet 1`] = ` halfWidth={false} header={ <FilterHeader - name="Tags" + name="projects.facets.tags" /> } highlightUnder={1} @@ -396,7 +396,7 @@ exports[`should render the tags without the ones in the facet 2`] = ` halfWidth={false} header={ <FilterHeader - name="Tags" + name="projects.facets.tags" /> } highlightUnder={1} |