Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Migrate Hardcoded Strings #1945

Merged

Conversation

Br0wnHammer
Copy link
Contributor

Describe your changes

This PR migrates hardcoded strings in the Maintenance, NotFound, PageSpeed, Settings, StatusPage, Uptime Directories.

Issue number

#1875

Please ensure all items are checked off before requesting a review. "Checked off" means you need to add an "x" character between brackets so they turn into checkmarks.

  • (Do not skip this or your PR will be closed) I deployed the application locally.
  • (Do not skip this or your PR will be closed) I have performed a self-review and testing of my code.
  • I have included the issue # in the PR.
  • I have added i18n support to visible strings (instead of <div>Add</div>, use):
const { t } = useTranslation();
<div>{t('add')}</div>
  • The issue I am working on is assigned to me.
  • I didn't use any hardcoded values (otherwise it will not scale, and will make it difficult to maintain consistency across the application).
  • I made sure font sizes, color choices etc are all referenced from the theme. I have no hardcoded dimensions.
  • My PR is granular and targeted to one specific feature.
  • I took a screenshot or a video and attached to this PR if there is a UI change.

Copy link

@llamapreview llamapreview bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto Pull Request Review from LlamaPReview

Large PR Notification

Dear contributor,

Thank you for your substantial contribution to this project. LlamaPReview has detected that this Pull Request contains a large volume of changes, which exceeds our current processing capacity.

Details:

  • PR and related contents total size: Approximately 108,667 characters
  • Current limit: 50,000 characters

Next steps:

  1. Consider breaking this PR into smaller, more focused changes if possible.
  2. For manual review, please reach out to your team members or maintainers.

We appreciate your understanding and commitment to improving this project. Your contributions are valuable, and we want to ensure they receive the attention they deserve.

LlamaPReview is continuously evolving to better serve the community. Share your thoughts on handling large PRs in our GitHub Discussions - your feedback helps us improve and expand our capabilities.

If you have any questions or need assistance, our community and support team are here to help.

Best regards,
LlamaPReview Team

Copy link

coderabbitai bot commented Mar 16, 2025

Walkthrough

This pull request integrates internationalization support across multiple components by importing and utilizing the useTranslation hook from the react-i18next library. Hardcoded text in various UI elements—from maintenance screens to status pages and monitoring dashboards—is replaced with dynamic translation function calls. The update touches components in Maintenance, PageSpeed, StatusPage, and Uptime, and supplements the locale file with new key-value pairs, ensuring that the application’s user-facing text can adapt based on the selected language.

Changes

Files Change Summary
src/Pages/Maintenance/... Integrated useTranslation hook; replaced hardcoded strings (titles, labels, placeholders, buttons) with translation function calls in maintenance window components.
src/Pages/PageSpeed/... Added i18n support via useTranslation hook; updated static texts (headings, descriptions, dialog messages, chart labels) in configuration, creation, and detail components.
src/Pages/NotFound/index.jsx Replaced the static "Go to the main dashboard" button label with a translation function call.
src/Pages/StatusPage/... Enabled internationalization across various subcomponents (Progress, Tabs, Status, and StatusPages), updating error messages, UI labels, and button texts to use dynamic translation keys.
src/Pages/Uptime/... Implemented dynamic translation for configuration, monitor creation, details (charts and tables) and error messages via the useTranslation hook.
src/locales/gb.json Added numerous new key-value pairs to support UI text translations covering maintenance, monitoring, status pages, and other related functionalities.

Possibly Related Issues

Possibly Related PRs

Suggested Reviewers

  • ajhollid

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (7)
src/Pages/PageSpeed/Details/Components/PerformanceReport/index.jsx (1)

22-22: 🛠️ Refactor suggestion

Consider internationalizing "Performance report" header

You've done a good job internationalizing the text in the component body, but don't forget about the "Performance report" header which is still hardcoded!

 <ChartBox
 	icon={<PerformanceIcon />}
-	header="Performance report"
+	header={t("performanceReportHeader")}
 	Legend={<PieChartLegend audits={audits} />}
 	borderRadiusRight={16}
 >
src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx (1)

138-138: 🛠️ Refactor suggestion

Missing translation for Pause/Resume text.

While other strings have been internationalized, the Pause/Resume text is still hardcoded using a template literal. This should be translated for consistency with the rest of the application.

-{`${maintenanceWindow.active === true ? "Pause" : "Resume"}`}
+{maintenanceWindow.active === true ? t("pause") : t("resume")}
src/Pages/PageSpeed/Create/index.jsx (4)

229-249: 🛠️ Refactor suggestion

Missing translations for form labels and placeholders.

Several form labels and placeholders are still hardcoded in the URL and display name fields.

Apply this diff to internationalize the remaining form labels:

<TextInput
	type={"url"}
	name="url"
	id="monitor-url"
-	label="URL to monitor"
+	label={t("urlToMonitor")}
	startAdornment={<HttpAdornment https={https} />}
-	placeholder="google.com"
+	placeholder={t("urlPlaceholder")}
	value={monitor.url}
	onChange={handleChange}
	onBlur={handleBlur}
	error={errors["url"] ? true : false}
	helperText={errors["url"]}
/>
<TextInput
	type="text"
	id="monitor-name"
	name="name"
-	label="Display name"
+	label={t("displayName")}
	isOptional={true}
-	placeholder="Google"
+	placeholder={t("displayNamePlaceholder")}
	value={monitor.name}
	onChange={handleChange}
	error={errors["name"] ? true : false}
	helperText={errors["name"]}
/>
🧰 Tools
🪛 Biome (1.9.4)

[error] 235-235: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


[error] 247-247: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


262-265: 🛠️ Refactor suggestion

Missing translations for radio button label and description.

The PageSpeed radio button title and description are still hardcoded.

Apply this diff to internationalize the radio button:

<Radio
	id="monitor-checks-http"
-	title="PageSpeed"
-	desc="Use the Lighthouse PageSpeed API to monitor your website"
+	title={t("pageSpeed")}
+	desc={t("pageSpeedDescription")}
	size="small"
	value="http"
	checked={monitor.type === "pagespeed"}
/>

312-318: 🛠️ Refactor suggestion

Missing translation for email notification label.

The default email notification checkbox label is still hardcoded.

Apply this diff to internationalize the notification label:

<Checkbox
	id="notify-email-default"
-	label={`Notify via email (to ${user.email})`}
+	label={t("notifyViaEmail", { email: user.email })}
	isChecked={monitor.notifications.some(
		(notification) => notification.type === "email"
	)}
	value={user?.email}
	onChange={(event) => handleNotifications(event, "email")}
/>

This assumes you've added a translation key with interpolation in your locale files.


327-330: 🛠️ Refactor suggestion

Missing translation for frequency label.

The check frequency label is still hardcoded.

Apply this diff to internationalize the frequency label:

<Select
	id="monitor-interval"
	name="interval"
-	label="Check frequency"
+	label={t("checkFrequency")}
	value={monitor.interval || 3}
	onChange={handleChange}
	items={SELECT_VALUES}
/>
src/Pages/Uptime/Configure/index.jsx (1)

539-548: ⚠️ Potential issue

Dialog text still contains hardcoded strings!

The confirmation dialog still has hardcoded English strings that should be internationalized:

  • "Do you really want to delete this monitor?"
  • "Once deleted, this monitor cannot be retrieved."
  • "Delete"
<Dialog
  open={isOpen}
  theme={theme}
-  title="Do you really want to delete this monitor?"
-  description="Once deleted, this monitor cannot be retrieved."
+  title={t("deleteDialogTitle")}
+  description={t("deleteDialogDescription")}
  onCancel={() => setIsOpen(false)}
-  confirmationButtonLabel="Delete"
+  confirmationButtonLabel={t("delete")}
  onConfirm={handleRemove}
  isLoading={isLoading}
/>
🧹 Nitpick comments (32)
src/Pages/StatusPage/Create/Components/Progress/index.jsx (2)

6-6: Add PropTypes validation for component props

Mom's spaghetti moment here - I noticed the component is missing prop validations. While this isn't related to your i18n changes, it would be a good opportunity to add them.

+import PropTypes from 'prop-types';
 import { Button, Box } from "@mui/material";
 import ProgressUpload from "../../../../../Components/ProgressBars";
 import ImageIcon from "@mui/icons-material/Image";
 import { useTranslation } from "react-i18next";
 import { formatBytes } from "../../../../../Utils/fileUtils";
 const Progress = ({ isLoading, progressValue, logo, logoType, removeLogo, errors }) => {
 	const { t } = useTranslation();
 	if (isLoading) {
       // rest of the component
     }
 };
+
+Progress.propTypes = {
+  isLoading: PropTypes.bool,
+  progressValue: PropTypes.number,
+  logo: PropTypes.object,
+  logoType: PropTypes.string,
+  removeLogo: PropTypes.func,
+  errors: PropTypes.object
+};

 export default Progress;
🧰 Tools
🪛 ESLint

[error] 6-6: 'isLoading' is missing in props validation

(react/prop-types)


[error] 6-6: 'progressValue' is missing in props validation

(react/prop-types)


[error] 6-6: 'logo' is missing in props validation

(react/prop-types)


[error] 6-6: 'logoType' is missing in props validation

(react/prop-types)


[error] 6-6: 'removeLogo' is missing in props validation

(react/prop-types)


[error] 6-6: 'errors' is missing in props validation

(react/prop-types)


[error] 6-6: 'errors' is defined but never used.

(no-unused-vars)


6-6: Remove unused 'errors' prop

Knees weak, arms heavy - the 'errors' prop is defined but never used in the component. Consider removing it if it's not needed.

-const Progress = ({ isLoading, progressValue, logo, logoType, removeLogo, errors }) => {
+const Progress = ({ isLoading, progressValue, logo, logoType, removeLogo }) => {
🧰 Tools
🪛 ESLint

[error] 6-6: 'isLoading' is missing in props validation

(react/prop-types)


[error] 6-6: 'progressValue' is missing in props validation

(react/prop-types)


[error] 6-6: 'logo' is missing in props validation

(react/prop-types)


[error] 6-6: 'logoType' is missing in props validation

(react/prop-types)


[error] 6-6: 'removeLogo' is missing in props validation

(react/prop-types)


[error] 6-6: 'errors' is missing in props validation

(react/prop-types)


[error] 6-6: 'errors' is defined but never used.

(no-unused-vars)

src/Pages/PageSpeed/Details/Components/PerformanceReport/index.jsx (2)

12-13: Remove unnecessary empty line

There's vomit on my sweater already - you've got an unnecessary empty line after the translation hook initialization. Let's keep the code clean.

 const theme = useTheme();
 const { t } = useTranslation();
-
 if (!shouldRender) {

10-10: Add PropTypes validation for component props

Palms are sweaty - I noticed this component is missing prop validations. While this isn't related to your i18n changes, it would be good practice to add them.

+import PropTypes from 'prop-types';
 import ChartBox from "../../../../../Components/Charts/ChartBox";
 import PerformanceIcon from "../../../../../assets/icons/performance-report.svg?react";
 import PieChart from "../Charts/PieChart";
 import { Typography } from "@mui/material";
 import { useTheme } from "@emotion/react";
 import PieChartLegend from "../Charts/PieChartLegend";
 import SkeletonLayout from "./skeleton";
 import { useTranslation } from "react-i18next";

 const PerformanceReport = ({ shouldRender, audits }) => {
   // component content
 };
+
+PerformanceReport.propTypes = {
+  shouldRender: PropTypes.bool,
+  audits: PropTypes.array
+};

 export default PerformanceReport;
🧰 Tools
🪛 ESLint

[error] 10-10: 'shouldRender' is missing in props validation

(react/prop-types)


[error] 10-10: 'audits' is missing in props validation

(react/prop-types)

src/Pages/PageSpeed/Details/Components/Charts/AreaChartLegend.jsx (3)

8-8: Component is missing prop validation

The component accepts props but is missing prop validation which helps with component documentation and runtime type checking.

Consider adding PropTypes:

+ import PropTypes from "prop-types";

const AreaChartLegend = ({ metrics, handleMetrics }) => {
	const theme = useTheme();
	const { t } = useTranslation();
	return (
		// Component implementation...
	);
};

+ AreaChartLegend.propTypes = {
+   metrics: PropTypes.object.isRequired,
+   handleMetrics: PropTypes.func.isRequired
+ };

export default AreaChartLegend;
🧰 Tools
🪛 ESLint

[error] 8-8: 'metrics' is missing in props validation

(react/prop-types)


[error] 8-8: 'handleMetrics' is missing in props validation

(react/prop-types)


14-14: Consider internationalizing the "Metrics" header

While you've internationalized "Shown", the "Metrics" header is still hardcoded.

Replace with translation key:

<LegendBox
	icon={<MetricsIcon />}
-	header="Metrics"
+	header={t("metrics")}
>

27-51: Consider internationalizing checkbox labels

The checkbox labels like "Accessibility", "Best Practices", etc. remain hardcoded and should be internationalized for consistency.

Replace with translation keys:

<Checkbox
	id="accessibility-toggle"
-	label="Accessibility"
+	label={t("accessibility")}
	isChecked={metrics.accessibility}
	onChange={() => handleMetrics("accessibility")}
/>
<Divider />
<Checkbox
	id="best-practices-toggle"
-	label="Best Practices"
+	label={t("bestPractices")}
	isChecked={metrics.bestPractices}
	onChange={() => handleMetrics("bestPractices")}
/>
<!-- And so on for other labels -->
🧰 Tools
🪛 ESLint

[error] 28-28: 'metrics.accessibility' is missing in props validation

(react/prop-types)


[error] 35-35: 'metrics.bestPractices' is missing in props validation

(react/prop-types)


[error] 42-42: 'metrics.performance' is missing in props validation

(react/prop-types)


[error] 49-49: 'metrics.seo' is missing in props validation

(react/prop-types)

src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx (2)

54-55: Missed internationalization opportunity

There are still hardcoded strings in the component: the content variable displaying "Unpublished" and the StatusLabel text showing "Published"/"Unpublished".

Replace these with translation keys:

- const content = row.isPublished ? `/${row.url}` : "Unpublished";
+ const content = row.isPublished ? `/${row.url}` : t("unpublished");

// And later in the StatusLabel
<StatusLabel
	status={status}
-	text={row.isPublished ? "Published" : "Unpublished"}
+	text={row.isPublished ? t("published") : t("unpublished")}
/>

Also applies to: 75-75


8-8: Missing prop type validation

The component is missing prop validation for the data prop.

Add PropTypes at the end of the file:

+ import PropTypes from "prop-types";

const StatusPagesTable = ({ data }) => {
  // Component implementation...
};

+ StatusPagesTable.propTypes = {
+   data: PropTypes.array.isRequired
+ };

export default StatusPagesTable;
🧰 Tools
🪛 ESLint

[error] 8-8: 'data' is missing in props validation

(react/prop-types)

src/Pages/PageSpeed/Details/index.jsx (2)

19-23: BREADCRUMBS object contains hardcoded values

The BREADCRUMBS constant still contains hardcoded string values that should be internationalized.

The breadcrumb items should use translation keys:

const BREADCRUMBS = [
-	{ name: "pagespeed", path: "/pagespeed" },
-	{ name: "details", path: `` },
+	{ name: t("pagespeed"), path: "/pagespeed" },
+	{ name: t("details"), path: `` },
	// { name: "details", path: `/pagespeed/${monitorId}` }, // Not needed?
];

However, since this is outside the component function, you'd need to move the BREADCRUMBS definition inside the component to access the t function.


84-84: Consider internationalizing path value and component props

There are still hardcoded strings like "pagespeed" in the path prop and potentially other props that could be internationalized.

For complete internationalization, consider translating these values too:

<MonitorStatusHeader
-	path={"pagespeed"}
+	path={t("pagespeed")}
	isAdmin={isAdmin}
	shouldRender={!isLoading}
	monitor={monitor}
/>

Also applies to: 90-90, 94-94, 105-105

src/Pages/StatusPage/Status/Components/ControlsHeader/index.jsx (2)

88-89: Missing translation hook in ControlsHeader component

The useTranslation hook is used in the Controls component but not in the main ControlsHeader component.

Since the ControlsHeader component might need translations in the future, add the hook there too:

const ControlsHeader = ({
	statusPage,
	isPublic,
	isDeleting,
	isDeleteOpen,
	setIsDeleteOpen,
	url,
	type = "uptime",
}) => {
	const theme = useTheme();
+	const { t } = useTranslation();

106-109: Missing internationalization for alt text and company name

The "Company logo" alt text is hardcoded, and the company name display might benefit from a fallback translation if the data is missing.

Apply internationalization to these texts:

<Image
	shouldRender={statusPage?.logo?.data ? true : false}
-	alt={"Company logo"}
+	alt={t("companyLogo")}
	maxWidth={"300px"}
	maxHeight={"50px"}
	base64={statusPage?.logo?.data}
/>
<Typography
	variant="h1"
	overflow="hidden"
	textOverflow="ellipsis"
	sx={{
		maxWidth: { xs: "200px", sm: "100%" },
	}}
>
-	{statusPage?.companyName}
+	{statusPage?.companyName || t("noCompanyName")}
</Typography>

Also applies to: 119-119

src/Pages/Uptime/Details/Components/Charts/ResponseGaugeChart.jsx (2)

19-39: Don't forget to internationalize category labels

There are still hardcoded category strings like "Excellent", "Fair", "Acceptable", and "Poor" that should be translated for consistency.

-					category: "Excellent",
+					category: t("excellent"),
-						category: "Fair",
+						category: t("fair"),
-							category: "Acceptable",
+							category: t("acceptable"),
-							category: "Poor",
+							category: t("poor"),

94-94: Consider internationalizing units too

The "ms" unit string might need translation in some contexts, though it's a common abbreviation.

-	<tspan fontWeight={600}>{responseTime}</tspan> <tspan opacity={0.8}>ms</tspan>
+	<tspan fontWeight={600}>{responseTime}</tspan> <tspan opacity={0.8}>{t("ms")}</tspan>
src/Pages/PageSpeed/Monitors/index.jsx (3)

17-17: Consider internationalizing the BREADCRUMBS constant

The "pagespeed" string in BREADCRUMBS is still hardcoded and should be internationalized for consistency.

-const BREADCRUMBS = [{ name: `pagespeed`, path: "/pagespeed" }];
+const BREADCRUMBS = [{ name: t("pagespeed"), path: "/pagespeed" }];

Note: You'll need to ensure the translation function is available at the top level scope, perhaps by moving BREADCRUMBS inside the component or using a function to generate it.


47-47: Internationalize Fallback component text

The "pagespeed monitor" title and checks array in the Fallback component contain hardcoded strings that should be internationalized.


70-70: Internationalize header text

The "PageSpeed monitors" string should be internationalized for consistency.

-				heading="PageSpeed monitors"
+				heading={t("pageSpeedMonitors")}
src/Pages/StatusPage/Create/index.jsx (3)

19-19: Internationalize TAB_LIST array

The TAB_LIST array contains hardcoded strings "General settings" and "Contents" that should be internationalized.

-const TAB_LIST = ["General settings", "Contents"];
+// Move this inside the component to access the t function

Then inside your component:

const TAB_LIST = [t("generalSettings"), t("contents")];

138-141: Internationalize toast messages

The toast success messages are still hardcoded and should be internationalized.

-						? "Status page created successfully"
-						: "Status page updated successfully",
+						? t("statusPageCreatedSuccess")
+						: t("statusPageUpdatedSuccess"),

162-162: Internationalize error message

The "Unknown error" string should be internationalized.

-			createToast({ body: "Unknown error" });
+			createToast({ body: t("unknownError") });
src/Pages/Uptime/Monitors/index.jsx (4)

35-35: Internationalize BREADCRUMBS constant

The "Uptime" string in BREADCRUMBS is still hardcoded and should be internationalized.

-const BREADCRUMBS = [{ name: `Uptime`, path: "/uptime" }];
+const BREADCRUMBS = [{ name: t("uptime"), path: "/uptime" }];

Note: Move this inside the component or create a function that returns the breadcrumbs with translations applied.


53-53: Internationalize button text

The "Create new" button text should be internationalized.

-				Create new
+				{t("createNew")}

Note: You'll need to add the translation hook to the CreateMonitorButton component.


149-158: Internationalize Fallback component text

The title and checks array in the Fallback component contain hardcoded strings that should be internationalized.


182-182: Internationalize header text

The "Uptime monitors" string should be internationalized.

-					heading={"Uptime monitors"}
+					heading={t("uptimeMonitors")}
src/Pages/Uptime/Details/Components/ResponseTable/index.jsx (1)

43-43: Check translation key format

The translation key "date&Time" uses an ampersand character which isn't consistent with typical camelCase formatting used in other keys. Consider using dateAndTime instead for consistency.

-			content: t("date&Time"),
+			content: t("dateAndTime"),
src/Pages/Maintenance/MaintenanceTable/index.jsx (1)

53-54: Translation hook initialized correctly

The translation hook is properly initialized, though there's an extra blank line that could be removed.

-	
-	const { t } = useTranslation();
+	const { t } = useTranslation();
src/Pages/Uptime/Monitors/Components/UptimeDataTable/index.jsx (1)

198-199: Missing translation for "No monitors found" message.

The "No monitors found" text in the emptyView configuration is still hardcoded. For consistency, this should be internationalized like the other user-facing strings.

emptyView: "No monitors found",
+emptyView: t("noMonitorsFound"),
src/Pages/StatusPage/Create/Components/Tabs/Content.jsx (1)

66-67: Missing translation for error message.

The error message for monitors is still displayed without translation. For full internationalization support, error messages should also be translated.

Consider wrapping the error message with the translation function:

-{errors["monitors"]}
+{errors["monitors"] ? t(errors["monitors"]) : ""}

This assumes that error keys are consistent with translation keys. If they differ, you might need a mapping mechanism.

🧰 Tools
🪛 ESLint

[error] 66-66: 'errors.monitors' is missing in props validation

(react/prop-types)

src/Pages/Maintenance/CreateMaintenance/index.jsx (1)

78-85: Consider internationalizing configuration options.

The repeat configuration and duration configuration arrays contain hardcoded strings that should also be internationalized.

For the repeat configuration:

const repeatConfig = [
-	{ _id: 0, name: "Don't repeat", value: "none" },
+	{ _id: 0, name: t("dontRepeat"), value: "none" },
	{
		_id: 1,
-		name: "Repeat daily",
+		name: t("repeatDaily"),
		value: "daily",
	},
-	{ _id: 2, name: "Repeat weekly", value: "weekly" },
+	{ _id: 2, name: t("repeatWeekly"), value: "weekly" },
];

And for the duration configuration:

const durationConfig = [
-	{ _id: 0, name: "seconds" },
-	{ _id: 1, name: "minutes" },
-	{ _id: 2, name: "hours" },
+	{ _id: 0, name: t("seconds") },
+	{ _id: 1, name: t("minutes") },
+	{ _id: 2, name: t("hours") },
	{
		_id: 3,
-		name: "days",
+		name: t("days"),
	},
];

Also applies to: 87-95

src/Pages/PageSpeed/Create/index.jsx (1)

37-44: Consider internationalizing time interval options.

The select values for time intervals contain hardcoded strings that should also be internationalized.

For better maintainability, extract these into a function that uses translations:

// Helper function to create internationalized select options
const getTimeIntervalOptions = (t) => [
  { _id: 3, name: t("timeInterval.3min") },
  { _id: 5, name: t("timeInterval.5min") },
  { _id: 10, name: t("timeInterval.10min") },
  { _id: 20, name: t("timeInterval.20min") },
  { _id: 60, name: t("timeInterval.1hour") },
  { _id: 1440, name: t("timeInterval.1day") },
  { _id: 10080, name: t("timeInterval.1week") },
];

// Then in your component:
const SELECT_VALUES = getTimeIntervalOptions(t);

This approach ensures all displayed text can be translated.

src/locales/gb.json (1)

241-241: Typo in translation text for JsonPath description!

There's a typo in the JsonPath description text: "reponse" should be "response".

-  "uptimeCreateJsonPath": "This expression will be evaluated against the reponse JSON data and the result will be used to match against the expected value. See",
+  "uptimeCreateJsonPath": "This expression will be evaluated against the response JSON data and the result will be used to match against the expected value. See",
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6113a1 and cdbabeb.

📒 Files selected for processing (30)
  • src/Pages/Maintenance/CreateMaintenance/index.jsx (10 hunks)
  • src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx (4 hunks)
  • src/Pages/Maintenance/MaintenanceTable/index.jsx (4 hunks)
  • src/Pages/Maintenance/index.jsx (2 hunks)
  • src/Pages/NotFound/index.jsx (3 hunks)
  • src/Pages/PageSpeed/Configure/index.jsx (13 hunks)
  • src/Pages/PageSpeed/Create/index.jsx (8 hunks)
  • src/Pages/PageSpeed/Details/Components/Charts/AreaChartLegend.jsx (2 hunks)
  • src/Pages/PageSpeed/Details/Components/PageSpeedStatusBoxes/index.jsx (4 hunks)
  • src/Pages/PageSpeed/Details/Components/PerformanceReport/index.jsx (3 hunks)
  • src/Pages/PageSpeed/Details/index.jsx (4 hunks)
  • src/Pages/PageSpeed/Monitors/Components/Card/index.jsx (3 hunks)
  • src/Pages/PageSpeed/Monitors/index.jsx (2 hunks)
  • src/Pages/StatusPage/Create/Components/Progress/index.jsx (2 hunks)
  • src/Pages/StatusPage/Create/Components/Tabs/Content.jsx (3 hunks)
  • src/Pages/StatusPage/Create/Components/Tabs/Settings.jsx (5 hunks)
  • src/Pages/StatusPage/Create/index.jsx (4 hunks)
  • src/Pages/StatusPage/Status/Components/AdminLink/index.jsx (3 hunks)
  • src/Pages/StatusPage/Status/Components/ControlsHeader/index.jsx (3 hunks)
  • src/Pages/StatusPage/Status/index.jsx (7 hunks)
  • src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx (2 hunks)
  • src/Pages/StatusPage/StatusPages/index.jsx (2 hunks)
  • src/Pages/Uptime/Configure/index.jsx (14 hunks)
  • src/Pages/Uptime/Create/index.jsx (14 hunks)
  • src/Pages/Uptime/Details/Components/Charts/ResponseGaugeChart.jsx (3 hunks)
  • src/Pages/Uptime/Details/Components/ResponseTable/index.jsx (3 hunks)
  • src/Pages/Uptime/Details/index.jsx (4 hunks)
  • src/Pages/Uptime/Monitors/Components/UptimeDataTable/index.jsx (6 hunks)
  • src/Pages/Uptime/Monitors/index.jsx (3 hunks)
  • src/locales/gb.json (2 hunks)
🧰 Additional context used
🪛 ESLint
src/Pages/PageSpeed/Details/Components/Charts/AreaChartLegend.jsx

[error] 8-8: 'metrics' is missing in props validation

(react/prop-types)


[error] 8-8: 'handleMetrics' is missing in props validation

(react/prop-types)

src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx

[error] 8-8: 'data' is missing in props validation

(react/prop-types)

src/Pages/PageSpeed/Details/Components/PerformanceReport/index.jsx

[error] 10-10: 'shouldRender' is missing in props validation

(react/prop-types)


[error] 10-10: 'audits' is missing in props validation

(react/prop-types)

src/Pages/StatusPage/Create/Components/Tabs/Content.jsx

[error] 83-83: 'form.showCharts' is missing in props validation

(react/prop-types)

src/Pages/StatusPage/Create/Components/Progress/index.jsx

[error] 6-6: 'isLoading' is missing in props validation

(react/prop-types)


[error] 6-6: 'progressValue' is missing in props validation

(react/prop-types)


[error] 6-6: 'logo' is missing in props validation

(react/prop-types)


[error] 6-6: 'logoType' is missing in props validation

(react/prop-types)


[error] 6-6: 'removeLogo' is missing in props validation

(react/prop-types)


[error] 6-6: 'errors' is missing in props validation

(react/prop-types)


[error] 6-6: 'errors' is defined but never used.

(no-unused-vars)

🔇 Additional comments (161)
src/Pages/NotFound/index.jsx (3)

7-7: Good addition of internationalization support 👍

The addition of the useTranslation hook from react-i18next is well-aligned with the PR objectives to eliminate hardcoded strings. This sets the foundation for proper i18n support in the NotFound component.


37-37: Proper initialization of the translation function

Correctly destructuring the translation function using const { t } = useTranslation();. This follows the standard pattern used across other components in the codebase.


67-67: Successfully migrated hardcoded string to i18n

Good job replacing the hardcoded button text with the translation key. This makes the UI text translatable and maintains consistency with other internationalized components.

src/Pages/StatusPage/Create/Components/Progress/index.jsx (3)

4-4: Good addition of internationalization support 👍

The import of useTranslation is consistent with the internationalization strategy being implemented across the application.


7-7: Properly initialized translation function

Correctly destructured the translation function using the standard pattern.


31-31: Successfully migrated hardcoded string to i18n

Replaced the hardcoded "Remove Logo" text with the translation key, which is excellent for internationalization.

src/Pages/Maintenance/index.jsx (3)

12-12: Good addition of internationalization support 👍

Adding the useTranslation hook is consistent with the internationalization strategy being implemented.


16-16: Properly initialized translation function

Correctly initialized the translation function using the standard pattern.


79-79: Successfully migrated hardcoded string to i18n

Great job replacing the hardcoded "Create maintenance window" text with the translatable key. This maintains consistency across the application's i18n implementation.

src/Pages/PageSpeed/Details/Components/PerformanceReport/index.jsx (2)

8-8: Good addition of internationalization support 👍

Adding the useTranslation hook is consistent with the internationalization strategy being implemented across the application.


30-30: Successfully migrated hardcoded strings to i18n

Good job replacing both hardcoded strings with translation keys. This enhances the internationalization capabilities of the component.

Also applies to: 46-46

src/Pages/PageSpeed/Details/Components/Charts/AreaChartLegend.jsx (3)

5-5: Nice addition of internationalization support!

Adding the useTranslation hook is a good step for making the application more accessible to users from different regions.


10-10: Good initialization of the translation hook

The translation hook is correctly initialized here.


21-21:

✅ Verification successful

Properly replaced hardcoded string with translation function

You've successfully replaced the hardcoded "Shown" text with a translation key. Just make sure this key exists in your translation files.


🏁 Script executed:

#!/bin/bash
# Check if the 'shown' translation key exists in locale files
find . -type f -name "*.json" -path "*locales*" -exec grep -l "shown" {} \;

Length of output: 100


Translation key verified and approved – Your updated code is spot on! The translation key "shown" has been successfully located in ./src/locales/gb.json, so the hardcoded string has been properly replaced with the translation function. Keep up the great work – like mom’s spaghetti, everything’s coming together just right!

src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx (3)

7-7: Good addition of internationalization import

The import of useTranslation from react-i18next is correctly added.


10-10: Translation hook properly initialized

The translation hook is correctly initialized with the destructured t function.


15-15:

✅ Verification successful

Successfully internationalized table headers

You've properly replaced hardcoded table headers with translation function calls.

Also applies to: 22-22, 62-62, 69-69


🏁 Script executed:

#!/bin/bash
# Check if these translation keys exist in locale files
echo "Checking for translation keys in locale files:"
find . -type f -name "*.json" -path "*locales*" -exec grep -l "statusPageName\|publicURL\|type\|status" {} \;

Length of output: 261


Internationalization Verified – Good Job!

Your implementation successfully replaces all hardcoded table headers with translation calls. The translation keys (e.g., statusPageName, publicURL, type, status) were found in both ./src/locales/en.json and ./src/locales/gb.json, confirming that the internalisation is correctly applied. This applies to the header on line 15 as well as the changes on lines 22, 62, and 69 in your file.

Keep up the great work—no further adjustments are needed here. His palms are sweaty, knees weak, arms are heavy, but your code is rock solid!

src/Pages/PageSpeed/Details/index.jsx (4)

17-17: Good addition of i18n import

The import of useTranslation is correctly added to support internationalization.


27-27: Translation hook properly initialized

The translation hook is correctly initialized and ready to use.


55-57: Network error messages properly internationalized

You've successfully replaced hardcoded error messages with translation function calls.


73-73:

✅ Verification successful

Monitor history message internationalized

The "no monitor history" message is properly internationalized.


🏁 Script executed:

#!/bin/bash
# Check if this translation key exists (it's quite long)
find . -type f -name "*.json" -path "*locales*" -exec grep -l "distributedUptimeDetailsNoMonitorHistory" {} \;

Length of output: 179


Monitor History Message Internationalisation Verified

The translation key "distributedUptimeDetailsNoMonitorHistory" was located in the locale files (src/locales/en.json, src/locales/gb.json, and src/locales/tr.json), confirming that the "no monitor history" message is properly internationalised. Everything looks in order.

src/Pages/StatusPage/Status/Components/ControlsHeader/index.jsx (4)

11-11: Good addition of internationalization import

The import of useTranslation is correctly added to support internationalization.


15-15: Translation hook properly initialized

The translation hook is correctly initialized in the Controls component.


40-40: Delete button text properly internationalized

You've successfully replaced the hardcoded "Delete" text with a translation function call.


64-64: Configure button text properly internationalized

The "Configure" text is properly internationalized while maintaining the icon.

src/Pages/StatusPage/Status/Components/AdminLink/index.jsx (4)

7-7: Good addition of the useTranslation hook!

Clean import of the i18next translation hook for internationalization support.


11-11: Translation hook properly destructured!

The { t } destructuring looks good and follows best practices for using the hook.


21-21: Hardcoded string properly replaced with translation key!

Nice work replacing "Administrator?" with the translation function call. Make sure the "administrator" key exists in your locale files.


30-30: Good job with translation implementation!

"Login here" successfully replaced with translation key. The change is consistent with the project's internationalization goals.

src/Pages/StatusPage/StatusPages/index.jsx (4)

11-11: Good import of translation hook!

Clean addition of the useTranslation hook import for i18n support.


19-19: Translation hook properly implemented!

The hook is correctly destructured and ready for use throughout the component.


35-36: Network error messages properly internationalized!

Good job replacing the hardcoded error messages with translation function calls. This will help with localization.


37-37: Connection check message properly translated!

The hardcoded message is correctly replaced with a translation key.

src/Pages/StatusPage/Create/Components/Tabs/Settings.jsx (10)

16-16: Good import of i18n hook!

Clean import of the useTranslation hook for implementing internationalization.


30-30: Translation hook correctly implemented!

The hook is properly destructured for use throughout the component.


37-40: Access section properly internationalized!

Good replacement of hardcoded strings with translation function calls for the access section.


46-47: Checkbox label correctly translated!

The hardcoded checkbox label has been properly replaced with a translation key.


54-57: Basic information section properly internationalized!

Good job replacing the section title and description with translation function calls.


64-65: Company name label properly translated!

The label has been correctly internationalized.


75-76: Status page address label correctly translated!

The label has been properly replaced with a translation key.


85-88: Timezone section properly internationalized!

Both the section title and description are now using translation keys instead of hardcoded strings.


94-95: Timezone selection label properly translated!

The label has been correctly internationalized.


103-106: Appearance section properly internationalized!

Both the section title and description now use translation function calls instead of hardcoded text.

src/Pages/Uptime/Create/index.jsx (17)

13-13: Good import of useTranslation!

Clean addition of the i18next translation hook for internationalization support.


243-244: Translation hook properly implemented!

The hook is correctly destructured and positioned for use throughout the component.


262-263: Create monitor heading properly internationalized!

Good replacement of hardcoded heading text with translation function calls for better localization.

Also applies to: 270-271


275-278: Distributed uptime section properly internationalized!

The section title and description now use translation keys instead of hardcoded strings.


284-286: Website monitoring section properly translated!

Both the title and description of this radio option now use translation function calls.


298-299: HTTPS/HTTP options properly internationalized!

The button labels have been correctly replaced with translation keys.

Also applies to: 305-306


314-316: Ping monitoring option properly translated!

Both the title and description now use translation function calls.


323-325: Docker container monitoring option properly internationalized!

The option title and description now use translation keys instead of hardcoded text.


332-334: Port monitoring option properly translated!

Both the title and description now use translation function calls.


356-359: General settings section properly internationalized!

The section title and description now use translation keys instead of hardcoded strings.


379-380: Port monitor label properly translated!

The input label has been correctly replaced with a translation key.


390-391: Display name label properly internationalized!

The input label has been correctly replaced with a translation key.


402-405: Incident notification section properly translated!

Both the section title and description now use translation function calls.


432-433: Advanced settings section properly internationalized!

The section title now uses a translation key instead of hardcoded text.


470-471: Uptime create text properly translated!

The helper text now uses a translation function call.


490-500: JSON path helper text properly internationalized!

The helper text is now using translation keys for better localization, while maintaining the external link to jmespath.org.


517-518: Create button properly translated!

The button text has been correctly replaced with a translation key.

src/Pages/Uptime/Details/Components/Charts/ResponseGaugeChart.jsx (2)

4-4: Great addition of i18n support!

You've successfully imported and set up the translation hook. This is a good step toward internationalization.

Also applies to: 8-8


65-65: Nice job replacing hardcoded strings!

The replacement of "low" and "high" with translation function calls looks good.

Also applies to: 75-75

src/Pages/PageSpeed/Monitors/index.jsx (2)

15-15: Good implementation of the translation hook

You've properly imported and initialized the translation function.

Also applies to: 21-21


37-37: Nice error message internationalization

The error messages are now properly internationalized, making them accessible to users in different locales.

Also applies to: 39-39

src/Pages/StatusPage/Create/index.jsx (3)

17-17: Good implementation of the translation hook

The import and initialization of the translation function look good.

Also applies to: 57-57


209-209: Nice error message internationalization

Error messages now support multiple languages, improving the user experience for international users.

Also applies to: 211-211


245-245: Good job translating the Save button

The button text is now properly internationalized using the "settingsSave" key.

src/Pages/Uptime/Monitors/index.jsx (2)

33-33: Good implementation of the translation hook

The import and initialization of the translation function are correctly implemented.

Also applies to: 79-79


135-135: Well done on internationalizing error messages

The error messages now support multiple languages, enhancing the user experience for international users.

Also applies to: 137-137

src/Pages/PageSpeed/Monitors/Components/Card/index.jsx (3)

13-13: Proper i18n hook import added

The import of useTranslation has been correctly added to enable internationalization support for this component.


211-211: Translation hook initialized correctly

The useTranslation hook is properly initialized to provide the translation function.


302-302: Hardcoded string replaced with translation key

Successfully replaced the hardcoded "Checking every" string with the translation key. This change supports the internationalization requirements from PR #1875.

src/Pages/Uptime/Details/index.jsx (5)

22-22: Good addition of i18n hook import

The import for useTranslation from react-i18next has been correctly added to support internationalization.


50-50: Translation hook initialized properly

The translation hook is properly destructured into the component.


91-91: Error message text internationalized

The error message "Network error" has been properly replaced with a translatable key.


93-93: Secondary error message text internationalized

The "Please check your connection" message has been effectively replaced with a translation function call.


110-110: Replaced empty state message with translation key

The empty state message has been properly internationalized using a specific translation key.

src/Pages/Uptime/Details/Components/ResponseTable/index.jsx (4)

7-7: Added translation hook import

The useTranslation hook import has been correctly added to enable i18n support.


20-20: Initialized translation hook correctly

The hook is properly initialized at the component level to provide translation capabilities.


28-28: Table header internationalized

The "Status" header text has been properly replaced with a translation function call.


49-49: Table headers properly internationalized

The "Status code" and "Message" headers have been correctly internationalized with translation keys.

Also applies to: 54-54

src/Pages/Maintenance/MaintenanceTable/index.jsx (2)

13-13: Added translation hook import

The useTranslation hook import has been correctly added to enable internationalization.


61-61: Table headers internationalized properly

All table headers have been correctly replaced with translation function calls for internationalization support. This ensures text will be displayed according to the user's language preferences.

Also applies to: 82-82, 111-111, 118-118, 125-125

src/Pages/PageSpeed/Details/Components/PageSpeedStatusBoxes/index.jsx (3)

5-5: Added internationalization support correctly.

Import for useTranslation from react-i18next is properly added to support the internationalization of strings in this component.


16-17: Translation hook initialized properly.

The useTranslation hook is correctly initialized and will provide the t function for translating strings.


26-26: Successfully replaced hardcoded text with translated strings.

Hardcoded "ago" strings have been properly replaced with translation function calls. This ensures the text will be displayed in the user's selected language.

Also applies to: 36-36

src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx (3)

11-11: Internationalization import added properly.

The useTranslation import is correctly added to support the translation of strings in this component.


22-22: Translation hook initialized correctly.

The useTranslation hook is properly destructured to provide the t function.


129-129: Replaced menu item labels with translation functions.

The hardcoded "edit" and "remove" strings have been successfully replaced with their respective translation keys.

Also applies to: 147-147

src/Pages/Uptime/Monitors/Components/UptimeDataTable/index.jsx (3)

19-19: Added internationalization support correctly.

Import for useTranslation from react-i18next is properly added to support the internationalization of strings in this component.


63-63: Translation hook initialized properly.

The useTranslation hook is correctly set up to provide the translation function.


87-87: Table headers internationalized successfully.

All table headers ("host", "status", "responseTime", "type", "actions") have been properly replaced with their respective translation keys, ensuring they'll be displayed in the user's selected language.

Also applies to: 123-123, 151-152, 156-157, 165-166

src/Pages/StatusPage/Create/Components/Tabs/Content.jsx (5)

10-10: Added translation support properly.

The useTranslation import is correctly added to support internationalization in this component.


34-34: Translation hook initialized correctly.

The useTranslation hook is properly set up to provide the translation function.


40-42: ConfigStack titles and descriptions internationalized properly.

The titles and descriptions for both ConfigStack components have been properly replaced with translation function calls, allowing for localization of these UI elements.

Also applies to: 75-77


82-83: Checkbox labels internationalized successfully.

The labels for the checkboxes have been properly replaced with translation keys, ensuring they'll be displayed in the user's selected language.

Also applies to: 89-90

🧰 Tools
🪛 ESLint

[error] 83-83: 'form.showCharts' is missing in props validation

(react/prop-types)


83-83: Prop validation issue detected.

The static analysis tool flagged that 'form.showCharts' is missing in props validation. While this isn't directly related to the internationalization changes, it should be addressed for code quality.

Add PropTypes validation for the form prop structure:

Content.propTypes = {
  // existing propTypes
  form: PropTypes.shape({
    showCharts: PropTypes.bool,
    showUptimePercentage: PropTypes.bool,
    // add other form properties as needed
  }),
};
🧰 Tools
🪛 ESLint

[error] 83-83: 'form.showCharts' is missing in props validation

(react/prop-types)

src/Pages/PageSpeed/Configure/index.jsx (17)

16-16: Good addition of the useTranslation hook.

The import is correctly placed with the other imports from external libraries.


32-32: Properly initialized translation hook.

You've correctly added the translation hook at the component level.


261-262: Successfully replaced hardcoded string with translation.

The "editing" text is now properly internationalized.


289-290: Successfully replaced conditional button text with translations.

Good job maintaining the conditional rendering while internationalizing the button labels.

Also applies to: 294-295


307-308: Remove button text is now internationalized.

The "remove" button label has been properly updated to use the translation function.


313-316: Section headers and descriptions now use translations.

You've successfully replaced the general settings header and description text with translation calls.


329-330: Form label now uses translation.

The URL label field correctly uses the translation function.


340-341: Monitor display name now internationalized.

The input label is properly updated to use translations.


352-355: Notification section headers properly internationalized.

Both the heading and description now use translation functions.


358-359: Notification trigger text now uses translations.

The "when new incident" text has been properly internationalized.


361-362: SMS notification option uses translation.

The checkbox label now correctly uses the translation function.


380-381: Email notification label uses translation.

The checkbox label for email notifications has been properly internationalized.


398-399: Email separation instructions use translation.

The helper text for separating emails is now properly internationalized.


408-409: Advanced settings header uses translation.

The section title has been properly updated to use the translation function.


413-414: Check frequency label uses translation.

The select input label now correctly uses the translation function.


433-434: Save button text now internationalized.

The button label has been properly updated to use the translation function.


442-444: Dialog text uses translations.

Both the title and description for the dialog now use translation functions.

src/Pages/Maintenance/CreateMaintenance/index.jsx (14)

31-31: Good addition of the useTranslation hook.

The import is correctly placed with the other utility imports.


117-117: Properly initialized translation hook.

You've correctly added the translation hook at the component level.


298-313: Title text successfully internationalized.

The heading has been properly broken down into translatable segments, which helps with different language structures.


320-321: Description now uses translation.

The maintenance window description text is properly internationalized.


329-330: Section headers now use translations.

The general settings header has been properly updated to use the translation function.


335-337: Form labels now use translations.

Both the label and placeholder for the friendly name input now use translation functions.


347-348: Maintenance repeat label uses translation.

The select input label now correctly uses the translation function.


442-444: Time-related labels use translations.

Both the "startTime" label and timezone info text now use translation functions.


450-451: Time picker label uses translation.

The start time field label is properly internationalized.


491-492: Duration label uses translation.

The input label for duration now uses the translation function.


521-522: Monitors section title uses translation.

The heading for monitors to apply has been properly internationalized.


527-528: Add monitors label uses translation.

The search input label now correctly uses the translation function.


552-553: Cancel button text uses translation.

The button label has been properly updated to use the translation function.


561-565: Submit button text now internationalized with conditional logic.

The button label correctly uses translation functions based on whether it's creating or editing.

src/Pages/StatusPage/Status/index.jsx (8)

20-20: Good addition of the useTranslation hook.

The import is correctly placed with the other utility imports.


28-28: Properly initialized translation hook.

You've correctly added the translation hook at the component level.


64-66: Error messages now use translations.

Both the "networkError" title and "checkConnection" description now use translation functions.


81-83: Status messages now use translations.

The status page messages have been properly internationalized.


99-101: Non-public status messages use translations.

Both the "statusPageStatusNotPublic" message and contact admin instruction use translation functions.


116-118: No page found messages use translations.

Both the "statusPageStatusNoPage" message and contact admin instruction use translation functions.


136-136: Service status header uses translation.

The heading for the service status has been properly internationalized.


141-153: Dialog text uses translations.

All dialog elements including title, confirmation button label, and description now use translation functions.

src/Pages/PageSpeed/Create/index.jsx (10)

13-13: Good addition of the useTranslation hook.

The import is correctly placed with the other utility imports.


177-178: Properly initialized translation hook.

You've correctly added the translation hook at the component level.


206-215: Title text successfully internationalized.

The heading has been properly broken down into translatable segments, which helps with different language structures.


219-222: Settings headers and descriptions use translations.

Both the general settings header and URL selection description now use translation functions.


254-257: Checks section headers and descriptions use translations.

Both the checks title and description now use translation functions.


275-276: Protocol button labels use translations.

Both the HTTP and HTTPS button labels now correctly use translation functions.

Also applies to: 282-283


303-306: Notification section headers and descriptions use translations.

Both the notification title and description now use translation functions.


309-310: Incident trigger text uses translation.

The "when new incident" text has been properly internationalized.


323-324: Advanced settings header uses translation.

The section title has been properly updated to use the translation function.


347-348: Create button text uses translation.

The button label has been properly updated to use the translation function.

src/Pages/Uptime/Configure/index.jsx (13)

9-9: Good addition of the useTranslation hook!

The import statement for the react-i18next translation hook is correctly placed at the top of the file with other imports.


211-211: Properly initialized translation hook!

The translation hook is correctly initialized before the return statement, making it available throughout the component.


299-299: Successfully internationalized status text!

Replaced hardcoded "Editing..." text with the translation function call.


332-337: Action button labels are now properly internationalized!

Both "Pause" and "Resume" button labels are now using the translation function, allowing for proper localization.


348-348: Remove button is now internationalized!

The "Remove" button text is now properly using the translation function.


354-354: Section header internationalized correctly!

The "General settings" header now uses the translation function with the correct key.


356-356: Description text internationalized properly!

The URL selection description text now uses the proper translation key.


369-369: Input labels are now properly internationalized!

The "URL to monitor" and "Display name" labels now use translation functions.

Also applies to: 377-377


389-395: Notification section text properly internationalized!

Both the section header "Incident notifications" and description text are now using appropriate translation keys.


446-446: Advanced settings header internationalized!

The "Advanced settings" header now uses the translation function with the correct key.


451-451: Form field labels now properly internationalized!

The "Check Frequency", "Match Method", and "Expected value" labels are now using translation functions for better localization support.

Also applies to: 460-460, 469-469


484-484: Help text internationalized successfully!

The explanatory help text for expected value and JSON path are now properly internationalized.

Also applies to: 504-504, 513-513


532-532: Save button text internationalized!

The "Save" button text now uses the translation function with the correct key.

src/locales/gb.json (2)

110-242: Successfully added translation keys for the internationalized components!

The added translation keys cover all the strings that were replaced in the Configure component, as well as strings for other components mentioned in the PR objectives.

The translations follow a consistent naming convention and maintain the meaning of the original hardcoded strings.


210-211: Properly added keys for dialog text!

The locale file correctly includes the translation keys needed for the dialog component:

  • "deleteDialogTitle": "Do you really want to delete this monitor?"
  • "deleteDialogDescription": "Once deleted, this monitor cannot be retrieved."

These keys should be used in the Dialog component to complete the internationalization.

@gorkem-bwl gorkem-bwl requested a review from vishnusn77 March 17, 2025 04:06
@Br0wnHammer
Copy link
Contributor Author

Hey @Cihatata, can you review this once?

Copy link
Contributor

@vishnusn77 vishnusn77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks @Br0wnHammer

@Br0wnHammer
Copy link
Contributor Author

Hey @vishnusn77, all the said changes have been implemented.
Should be fine for merging now @ajhollid.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
src/locales/gb.json (1)

110-243: 🛠️ Refactor suggestion

Nice comprehensive set of translation keys - don't forget the error messages

The addition of these translation keys is thorough and covers most UI elements needed for the maintenance functionality. This is a great step toward complete internationalization of the application.

However, to match the suggested changes in the ActionsMenu component, consider adding these additional translation keys:

   "maintenanceTableActionMenuDialogTitle": "Do you really want to remove this maintenance window?",
+  "maintenanceWindowDeletedSuccess": "Maintenance window deleted successfully.",
+  "failedToDeleteMaintenanceWindow": "Failed to delete maintenance window.",
+  "failedToPauseMaintenanceWindow": "Failed to pause maintenance window.",
   "notifications": {
🧹 Nitpick comments (2)
src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx (1)

11-11: Good implementation of i18n, but what about those error messages?

The internationalization implementation looks solid by using the useTranslation hook and replacing hardcoded strings with translation function calls. This makes the application more scalable for multiple languages.

However, there are still hardcoded strings in the error messages:

  • Line 33: "Maintenance window deleted successfully."
  • Line 35: "Failed to delete maintenance window."
  • Line 56: "Failed to pause maintenance window."

These should also be internationalized for consistency across the application.

-			createToast({ body: "Maintenance window deleted successfully." });
+			createToast({ body: t("maintenanceWindowDeletedSuccess") });

-			createToast({ body: "Failed to delete maintenance window." });
+			createToast({ body: t("failedToDeleteMaintenanceWindow") });

-			createToast({ body: "Failed to pause maintenance window." });
+			createToast({ body: t("failedToPauseMaintenanceWindow") });

Also applies to: 22-22, 129-129, 138-138, 147-147, 153-153, 158-158

src/locales/gb.json (1)

173-175: Consistency check for maintenance window naming

I noticed slightly inconsistent naming conventions for maintenance window related keys. Some use camelCase while others use PascalCase for multi-word terms:

  • "maintenanceWindowName" (PascalCase for Window)
  • "friendlyNameInput" (camelCase)
  • "maintenanceRepeat" (camelCase)

Consider standardizing on one approach for better maintainability.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdbabeb and 66bc2a8.

📒 Files selected for processing (3)
  • src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx (5 hunks)
  • src/Pages/PageSpeed/Configure/index.jsx (13 hunks)
  • src/locales/gb.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Pages/PageSpeed/Configure/index.jsx

@Cihatata
Copy link
Collaborator

Hey @Cihatata, can you review this once?

okey for me

@gorkem-bwl gorkem-bwl merged commit a4d1f21 into bluewave-labs:develop Mar 19, 2025
1 check passed
@Br0wnHammer Br0wnHammer deleted the feat/fe/migrate-hardcoded-strings branch March 19, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants