Skip to content

Commit

Permalink
fix(web): fix localization of overview headers (#1645)
Browse files Browse the repository at this point in the history
## Problem

Related to #1629.

Overview headers are not translated.

## Solution

Do not call `_()` at module level (see #1643).

## Testing

- Tested manually
  • Loading branch information
imobachgs authored Sep 27, 2024
2 parents e7a8f50 + 879cf2a commit ded8adb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
6 changes: 6 additions & 0 deletions web/package/agama-web-ui.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Sep 27 14:54:46 UTC 2024 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Translate overview page headers and a missing text in the
networking page (gh#agama-project/agama#1629).

-------------------------------------------------------------------
Fri Sep 27 13:00:05 UTC 2024 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/network/WifiNetworksListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function WifiNetworksListPage() {
<DrawerContentBody>
<Stack hasGutter>
{networks.length === 0 ? (
<EmptyState title="No visible Wi-Fi networks found" icon="error" />
<EmptyState title={_("No visible Wi-Fi networks found")} icon="error" />
) : (
// @ts-expect-error: related to https://github.com/patternfly/patternfly-react/issues/9823
<DataList
Expand Down
16 changes: 8 additions & 8 deletions web/src/components/overview/OverviewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ import { _ } from "~/i18n";
import { useAllIssues } from "~/queries/issues";
import { IssuesList as IssuesListType, IssueSeverity } from "~/types/issues";

const SCOPE_HEADERS = {
users: _("Users"),
storage: _("Storage"),
software: _("Software"),
};

const ReadyForInstallation = () => (
<Center>
<EmptyState title={_("Ready for installation")} icon="check_circle" color="success-color-100">
Expand All @@ -59,6 +53,12 @@ const ReadyForInstallation = () => (
);

const IssuesList = ({ issues }: { issues: IssuesListType }) => {
const scopeHeaders = {
users: _("Users"),
storage: _("Storage"),
software: _("Software"),
};

const { issues: issuesByScope } = issues;
const list = [];
Object.entries(issuesByScope).forEach(([scope, issues], idx) => {
Expand All @@ -68,7 +68,7 @@ const IssuesList = ({ issues }: { issues: IssuesListType }) => {
const link = (
<NotificationDrawerListItem key={`${idx}-${subIdx}`} variant={variant} isHoverable={false}>
<NotificationDrawerListItemHeader
title={SCOPE_HEADERS[scope]}
title={scopeHeaders[scope]}
variant={variant}
headingLevel="h4"
/>
Expand Down Expand Up @@ -109,7 +109,7 @@ const ResultSection = () => {

const OverviewSection = () => (
<Page.Section
title="Overview"
title={_("Overview")}
description={_(
"These are the most relevant installation settings. Feel free to browse the sections in the menu for further details.",
)}
Expand Down

0 comments on commit ded8adb

Please sign in to comment.