aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-02-08 12:19:05 +0100
committerStas Vilchik <stas.vilchik@sonarsource.com>2018-02-20 10:06:52 +0100
commitfff2b9bcc5e0668dfc36a8a34000aac0ae9c10e7 (patch)
tree41b6b137ab2e1b39ccc617ce121cf738f981807a
parent152588a68d439f3b48b448c56b83e592259dea52 (diff)
downloadsonarqube-fff2b9bcc5e0668dfc36a8a34000aac0ae9c10e7.tar.gz
sonarqube-fff2b9bcc5e0668dfc36a8a34000aac0ae9c10e7.zip
SONAR-10411 use link name from l10n bundle for provided links
-rw-r--r--server/sonar-web/src/main/js/apps/overview/meta/MetaLink.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/project-admin/links/LinkRow.js4
-rw-r--r--server/sonar-web/src/main/js/apps/project-admin/links/utils.js5
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties2
-rw-r--r--tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java1
5 files changed, 10 insertions, 6 deletions
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 (
<li>
<a className="link-with-icon" href={link.url} rel="nofollow" target="_blank">
- <MetaLinkIcon link={link} /> {link.name}
+ <MetaLinkIcon link={link} /> {getLinkName(link)}
</a>
</li>
);
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}`)}
<div className="display-inline-block text-top">
<div>
- <span className="js-name">{link.name}</span>
+ <span className="js-name">{getLinkName(link)}</span>
</div>
<div className="note little-spacer-top">
<span className="js-type">{`sonar.links.${link.type}`}</span>
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);