From 60686586a638bd709dbbfc3b1dcba5839ac01bc4 Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Wed, 3 Aug 2022 11:57:31 +0200 Subject: [PATCH] SONAR-16731 [891648] Buttons have same name but different actions --- .../components/project-card/ProjectCard.tsx | 1 + .../main/js/components/controls/Favorite.tsx | 16 +++++----- .../resources/org/sonar/l10n/core.properties | 32 +++++++++---------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx index e7d95020d66..7b06cc6385d 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx @@ -70,6 +70,7 @@ function renderFirstLine(project: Props['project'], handleFavorite: Props['handl void; @@ -82,22 +83,21 @@ export default class Favorite extends React.PureComponent { }; render() { - const { className, qualifier } = this.props; + const { className, componentName, qualifier } = this.props; const { favorite } = this.state; - const tooltip = favorite - ? translate('favorite.current', qualifier) - : translate('favorite.check', qualifier); - const ariaLabel = translate('favorite.action', favorite ? 'remove' : 'add'); + const actionName = favorite ? 'remove' : 'add'; + const tooltip = componentName + ? translateWithParameters(`favorite.action.${qualifier}.${actionName}_x`, componentName) + : translate('favorite.action', qualifier, actionName); return ( (this.buttonNode = node)} className={classNames('favorite-link', 'link-no-underline', className)} onClick={this.toggleFavorite}> - + ); 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 daba2a880ff..95aef3ccd94 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -4243,22 +4243,22 @@ homepage.check=Click to make the current page your homepage. # FAVORITE # #------------------------------------------------------------------------------ -favorite.action.add=Add project to favorites -favorite.action.remove=Remove project from favorites -favorite.check.TRK=Click to mark this project as favorite. -favorite.check.VW=Click to mark this portfolio as favorite. -favorite.check.SVW=Click to mark this sub-portfolio as favorite. -favorite.check.APP=Click to mark this application as favorite. -favorite.check.FIL=Click to mark this file as favorite. -favorite.check.UTS=Click to mark this test file as favorite. - -favorite.current.TRK=This project is marked as favorite. -favorite.current.VW=This portfolio is marked as favorite. -favorite.current.SVW=This sub-portfolio is marked as favorite. -favorite.current.APP=This application is marked as favorite. -favorite.current.FIL=This file is marked as favorite. -favorite.current.UTS=This test file is marked as favorite. - +favorite.action.TRK.add=Add this project to favorites +favorite.action.TRK.remove=Remove this project from favorites +favorite.action.VW.add=Add this portfolio to favorites +favorite.action.VW.remove=Remove this portfolio from favorites +favorite.action.SVW.add=Add sub-this portfolio to favorites +favorite.action.SVW.remove=Remove sub-this portfolio from favorites +favorite.action.APP.add=Add this application to favorites +favorite.action.APP.remove=Remove this application from favorites +favorite.action.TRK.add_x=Add project {0} to favorites +favorite.action.TRK.remove_x=Remove project {0} from favorites +favorite.action.VW.add_x=Add portfolio {0} to favorites +favorite.action.VW.remove_x=Remove portfolio {0} from favorites +favorite.action.SVW.add_x=Add sub-portfolio {0} to favorites +favorite.action.SVW.remove_x=Remove sub-portfolio {0} from favorites +favorite.action.APP.add_x=Add application {0} to favorites +favorite.action.APP.remove_x=Remove application {0} from favorites #------------------------------------------------------------------------------ -- 2.39.5