From 8c700081b51a1ca89e44ddfe4613dabb1349f774 Mon Sep 17 00:00:00 2001 From: Izumi Hoshino Date: Fri, 1 Mar 2024 00:53:42 +0900 Subject: [PATCH 1/2] Fixed an issue where some of the text translations were not working --- .../gui/src/components/nfts/NFTPreview.tsx | 2 +- .../plot/add/PlotAddChoosePlotter.tsx | 21 +++++++++------- .../gui/src/components/settings/Settings.tsx | 24 +++++++++---------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/packages/gui/src/components/nfts/NFTPreview.tsx b/packages/gui/src/components/nfts/NFTPreview.tsx index ec4f965d28..39bd0f3075 100644 --- a/packages/gui/src/components/nfts/NFTPreview.tsx +++ b/packages/gui/src/components/nfts/NFTPreview.tsx @@ -429,7 +429,7 @@ export default function NFTPreview(props: NFTPreviewProps) { {isLoading ? ( - {!isCompact && {isPreview ? 'Loading preview...' : 'Loading NFT...'}} + {!isCompact && (isPreview ? t`Loading preview...` : t`Loading NFT...`)} ) : !hasFile ? ( diff --git a/packages/gui/src/components/plot/add/PlotAddChoosePlotter.tsx b/packages/gui/src/components/plot/add/PlotAddChoosePlotter.tsx index 37c1a7b0ed..258d95e851 100644 --- a/packages/gui/src/components/plot/add/PlotAddChoosePlotter.tsx +++ b/packages/gui/src/components/plot/add/PlotAddChoosePlotter.tsx @@ -67,10 +67,19 @@ export default function PlotAddChoosePlotter(props: Props) { } const plotterWarningString = (name: PlotterName | undefined): string | undefined => { - if (name === PlotterName.BLADEBIT_RAM) { - return plotters[PlotterName.BLADEBIT_RAM]?.installInfo?.bladebitMemoryWarning; + if (name !== PlotterName.BLADEBIT_RAM) { + return undefined; } - return undefined; + const msg = plotters[PlotterName.BLADEBIT_RAM]?.installInfo?.bladebitMemoryWarning; + if (!msg) { + return undefined; + } + const regex = /BladeBit requires at least (?\d*[.]?\d+) GiB of RAM to operate/; + const m = regex.exec(msg); + if (!m || !m.groups || !m.groups.ram) { + return undefined; + } + return t`BladeBit requires at least ${m.groups.ram} GiB of RAM to operate`; }; const warning = plotterWarningString(plotterName); @@ -101,11 +110,7 @@ export default function PlotAddChoosePlotter(props: Props) { ))} - {warning && ( - - {warning} - - )} + {warning && {warning}} diff --git a/packages/gui/src/components/settings/Settings.tsx b/packages/gui/src/components/settings/Settings.tsx index add1362bb6..192e2ebcf7 100644 --- a/packages/gui/src/components/settings/Settings.tsx +++ b/packages/gui/src/components/settings/Settings.tsx @@ -1,6 +1,6 @@ import { useLocalStorage } from '@chia-network/api-react'; import { Flex, LayoutDashboardSub, Mode, useMode } from '@chia-network/core'; -import { Trans } from '@lingui/macro'; +import { Trans, t } from '@lingui/macro'; import { Typography, Tab, Tabs } from '@mui/material'; import Badge from '@mui/material/Badge'; import React, { useMemo } from 'react'; @@ -26,24 +26,24 @@ export default function Settings() { const settingsTabs = useMemo(() => { let tabs = [ - { id: 'general', label: 'General', Component: SettingsGeneral, path: 'general' }, + { id: 'general', label: t`General`, Component: SettingsGeneral, path: 'general' }, { id: 'custody', - label: 'Custody', + label: t`Custody`, Component: SettingsCustody, path: 'custody', badge: wasSettingsCustodyVisited ? undefined : 'NEW', }, - { id: 'profiles', label: 'Profiles (DIDs)', Component: SettingsProfiles, path: 'profiles/*' }, - { id: 'nft', label: 'NFT', Component: SettingsNFT, path: 'nft' }, - { id: 'datalayer', label: 'DataLayer', Component: SettingsDataLayer, path: 'datalayer' }, - { id: 'harvester', label: 'Harvester', Component: SettingsHarvester, path: 'harvester' }, - { id: 'integration', label: 'Integration', Component: SettingsIntegration, path: 'integration' }, - { id: 'notifications', label: 'Notifications', Component: SettingsNotifications, path: 'notifications' }, - { id: 'advanced', label: 'Advanced', Component: SettingsAdvanced, path: 'advanced' }, + { id: 'profiles', label: t`Profiles (DIDs)`, Component: SettingsProfiles, path: 'profiles/*' }, + { id: 'nft', label: t`NFT`, Component: SettingsNFT, path: 'nft' }, + { id: 'datalayer', label: t`DataLayer`, Component: SettingsDataLayer, path: 'datalayer' }, + { id: 'harvester', label: t`Harvester`, Component: SettingsHarvester, path: 'harvester' }, + { id: 'integration', label: t`Integration`, Component: SettingsIntegration, path: 'integration' }, + { id: 'notifications', label: t`Notifications`, Component: SettingsNotifications, path: 'notifications' }, + { id: 'advanced', label: t`Advanced`, Component: SettingsAdvanced, path: 'advanced' }, ]; if (mode === Mode.WALLET) { - tabs = tabs.filter((t) => t.id !== 'harvester'); + tabs = tabs.filter((tab) => tab.id !== 'harvester'); } return tabs; }, [wasSettingsCustodyVisited, mode]); @@ -82,7 +82,7 @@ export default function Settings() { sx={{ '& .MuiTabs-flexContainer': { paddingTop: '10px' } }} > {settingsTabs.map((tab) => { - let TabLabel = {tab.label}; + let TabLabel: React.ReactNode = tab.label; if (tab.badge) { TabLabel = ( Date: Fri, 1 Mar 2024 01:21:43 +0900 Subject: [PATCH 2/2] Added warning text for insufficient RAM for bladebit --- packages/gui/src/components/plot/add/PlotAddChoosePlotter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gui/src/components/plot/add/PlotAddChoosePlotter.tsx b/packages/gui/src/components/plot/add/PlotAddChoosePlotter.tsx index 258d95e851..2ea8756ff0 100644 --- a/packages/gui/src/components/plot/add/PlotAddChoosePlotter.tsx +++ b/packages/gui/src/components/plot/add/PlotAddChoosePlotter.tsx @@ -77,7 +77,7 @@ export default function PlotAddChoosePlotter(props: Props) { const regex = /BladeBit requires at least (?\d*[.]?\d+) GiB of RAM to operate/; const m = regex.exec(msg); if (!m || !m.groups || !m.groups.ram) { - return undefined; + return t`Insufficient RAM for BladeBit`; } return t`BladeBit requires at least ${m.groups.ram} GiB of RAM to operate`; };