]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-18054 Page title does not identify purpose of this page
authorstanislavh <stanislav.honcharov@sonarsource.com>
Fri, 3 Feb 2023 13:27:05 +0000 (14:27 +0100)
committersonartech <sonartech@sonarsource.com>
Mon, 6 Feb 2023 20:02:53 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts
server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index ce418a366498404301e5ea192011bd194d4c0b43..0827c6109bfcc57798cd69ebc25997341e0dbe11 100644 (file)
@@ -69,6 +69,7 @@ it('should show open rule with default description section', async () => {
   expect(
     await screen.findByRole('heading', { level: 3, name: 'Awsome java rule' })
   ).toBeInTheDocument();
+  expect(document.title).toEqual('coding_rule.page.Java.Awsome java rule');
   expect(screen.getByText('Why')).toBeInTheDocument();
   expect(screen.getByText('Because')).toBeInTheDocument();
 });
index 66e7210d3b27de15aed6efb6eeedd16cce85bd3d..db284a398d9ffb62ab9b8535c35f3ca4ae479760 100644 (file)
@@ -34,7 +34,7 @@ import BackIcon from '../../../components/icons/BackIcon';
 import '../../../components/search-navigator.css';
 import { isInput, isShortcut } from '../../../helpers/keyboardEventHelpers';
 import { KeyboardKeys } from '../../../helpers/keycodes';
-import { translate } from '../../../helpers/l10n';
+import { translate, translateWithParameters } from '../../../helpers/l10n';
 import {
   addSideBarClass,
   addWhitePageClass,
@@ -562,7 +562,14 @@ export class App extends React.PureComponent<Props, State> {
     return (
       <>
         <Suggestions suggestions="coding_rules" />
-        <Helmet defer={false} title={translate('coding_rules.page')}>
+        <Helmet
+          defer={false}
+          title={
+            openRule
+              ? translateWithParameters('coding_rule.page', openRule.langName, openRule.name)
+              : translate('coding_rules.page')
+          }
+        >
           <meta content="noindex" name="robots" />
         </Helmet>
         <div className="layout-page" id="coding-rules-page">
index b153374a68afe47c3c02eef16671e20c42ad494a..2f89fb5dc42c3d86ff5240ac9c4fc07582707e2e 100644 (file)
@@ -573,6 +573,7 @@ visibility.private.description.long=Only members of the organization will be abl
 #------------------------------------------------------------------------------
 
 coding_rules.page=Rules
+coding_rule.page={0} rule: {1}
 global_permissions.page=Global Permissions
 global_permissions.page.description=Grant and revoke permissions to make changes at the global level. These permissions include editing Quality Profiles, executing analysis, and performing global system administration.
 roles.page=Project Permissions