Skip to content

Commit

Permalink
fix: correctly localize breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dabolus committed Jan 7, 2024
1 parent e027378 commit d66f356
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/routes/dynamodb.tables/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const TablesList: FunctionComponent = () => {

return (
<>
{/* t('tables') */}
<CurrentPath items={['dynamodb', 'tables']} />
<Stack p={2}>
<Stack
Expand Down
7 changes: 4 additions & 3 deletions app/src/components/CurrentPath.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { OverridableComponent } from '@mui/material/OverridableComponent';
import { ChevronRight as ChevronRightIcon } from '@mui/icons-material';
import { visuallyHidden } from '@mui/utils';
import { kebabToTitleCase } from '../utils';
import { useTranslation } from 'react-i18next';
import { serviceToNameMap } from '../aws/common';

interface PathLinkProps extends RemixLinkProps {
Expand Down Expand Up @@ -53,6 +53,7 @@ export default function CurrentPath({
selectedItem,
withHeading,
}: CurrentPathProps) {
const { t } = useTranslation();
const pathItems: PathItem[] = ['home', ...items];
const lastItem = pathItems[pathItems.length - 1];
const selected = selectedItem ?? lastItem;
Expand All @@ -64,7 +65,7 @@ export default function CurrentPath({
const key = typeof item === 'string' ? item : item.key;
const name =
typeof item === 'string'
? serviceToNameMap[item] ?? kebabToTitleCase(item)
? serviceToNameMap[item] ?? t(item)
: item.name;
const to =
typeof item === 'string'
Expand All @@ -88,7 +89,7 @@ export default function CurrentPath({
{withHeading && (
<Typography variant="h2" sx={visuallyHidden}>
{typeof selected === 'string'
? serviceToNameMap[selected] ?? kebabToTitleCase(selected)
? serviceToNameMap[selected] ?? t(selected)
: selected.name}
</Typography>
)}
Expand Down

0 comments on commit d66f356

Please sign in to comment.