From: Stas Vilchik Date: Thu, 8 Feb 2018 11:19:05 +0000 (+0100) Subject: SONAR-10411 use link name from l10n bundle for provided links X-Git-Tag: 7.5~1645 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fff2b9bcc5e0668dfc36a8a34000aac0ae9c10e7;p=sonarqube.git SONAR-10411 use link name from l10n bundle for provided links --- diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.tsx b/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.tsx index 04c7ae09745..e4c9a697009 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.tsx +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaLink.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { isProvided } from '../../project-admin/links/utils'; +import { isProvided, getLinkName } from '../../project-admin/links/utils'; import BugTrackerIcon from '../../../components/ui/BugTrackerIcon'; import { ProjectLink } from '../../../api/projectLinks'; @@ -30,7 +30,7 @@ export default function MetaLink({ link }: Props) { return (
  • - {link.name} + {getLinkName(link)}
  • ); diff --git a/server/sonar-web/src/main/js/apps/project-admin/links/LinkRow.js b/server/sonar-web/src/main/js/apps/project-admin/links/LinkRow.js index 9c36959c021..3124fb9c8af 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/links/LinkRow.js +++ b/server/sonar-web/src/main/js/apps/project-admin/links/LinkRow.js @@ -19,7 +19,7 @@ */ import React from 'react'; import PropTypes from 'prop-types'; -import { isProvided } from './utils'; +import { isProvided, getLinkName } from './utils'; import { translate } from '../../../helpers/l10n'; import BugTrackerIcon from '../../../components/ui/BugTrackerIcon'; @@ -57,7 +57,7 @@ export default class LinkRow extends React.PureComponent { {this.renderIcon(`icon-${link.type}`)}
    - {link.name} + {getLinkName(link)}
    {`sonar.links.${link.type}`} diff --git a/server/sonar-web/src/main/js/apps/project-admin/links/utils.js b/server/sonar-web/src/main/js/apps/project-admin/links/utils.js index bfd19ca8da7..06539348fef 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/links/utils.js +++ b/server/sonar-web/src/main/js/apps/project-admin/links/utils.js @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { partition, sortBy } from 'lodash'; +import { translate } from '../../../helpers/l10n'; const PROVIDED_TYPES = ['homepage', 'ci', 'issue', 'scm', 'scm_dev']; @@ -32,3 +33,7 @@ export function orderLinks(links) { ...sortBy(unknown, link => link.name.toLowerCase()) ]; } + +export function getLinkName(link) { + return isProvided(link) ? translate('project_links', link.type) : link.name; +} diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index a8e95ab42bb..780c65b1206 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -395,7 +395,7 @@ qualifier.description.APP=Single-level aggregation with a technical focus and a # #------------------------------------------------------------------------------ -project_links.homepage=Home +project_links.homepage=Project's Website project_links.ci=Continuous integration project_links.issue=Bug Tracker project_links.scm=Sources diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java index e0858850cfc..a2a63ee87c9 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java @@ -81,7 +81,6 @@ public class ProjectLinksTest { ProjectLinkItem homepageLink = links.get(0); ProjectLinkItem customLink = links.get(1); - homepageLink.getName().should(text("Home")); homepageLink.getType().should(text("sonar.links.homepage")); homepageLink.getUrl().should(text("http://example.com")); homepageLink.getDeleteButton().shouldNot(Condition.exist);