Skip to content

Commit

Permalink
Merge pull request #2291 from Chia-Network/cmj.fix-i18n
Browse files Browse the repository at this point in the history
Fixed an issue where some of the text translations were not working
  • Loading branch information
seeden authored Feb 29, 2024
2 parents c97aecb + b457375 commit ea8a6a0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion packages/gui/src/components/nfts/NFTPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ export default function NFTPreview(props: NFTPreviewProps) {
<StyledCardPreview width={width} height={height} sx={{ aspectRatio: ratio.toString() }}>
{isLoading ? (
<Flex position="absolute" left="0" top="0" bottom="0" right="0" justifyContent="center" alignItems="center">
<Loading center>{!isCompact && <Trans>{isPreview ? 'Loading preview...' : 'Loading NFT...'}</Trans>}</Loading>
<Loading center>{!isCompact && (isPreview ? t`Loading preview...` : t`Loading NFT...`)}</Loading>
</Flex>
) : !hasFile ? (
<Background>
Expand Down
21 changes: 13 additions & 8 deletions packages/gui/src/components/plot/add/PlotAddChoosePlotter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (?<ram>\d*[.]?\d+) GiB of RAM to operate/;
const m = regex.exec(msg);
if (!m || !m.groups || !m.groups.ram) {
return t`Insufficient RAM for BladeBit`;
}
return t`BladeBit requires at least ${m.groups.ram} GiB of RAM to operate`;
};

const warning = plotterWarningString(plotterName);
Expand Down Expand Up @@ -101,11 +110,7 @@ export default function PlotAddChoosePlotter(props: Props) {
</MenuItem>
))}
</Select>
{warning && (
<StyledFormHelperText>
<Trans>{warning}</Trans>
</StyledFormHelperText>
)}
{warning && <StyledFormHelperText>{warning}</StyledFormHelperText>}
</FormControl>
</Grid>
</Grid>
Expand Down
24 changes: 12 additions & 12 deletions packages/gui/src/components/settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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]);
Expand Down Expand Up @@ -82,7 +82,7 @@ export default function Settings() {
sx={{ '& .MuiTabs-flexContainer': { paddingTop: '10px' } }}
>
{settingsTabs.map((tab) => {
let TabLabel = <Trans>{tab.label}</Trans>;
let TabLabel: React.ReactNode = tab.label;
if (tab.badge) {
TabLabel = (
<Badge
Expand Down

0 comments on commit ea8a6a0

Please sign in to comment.