Skip to content

Commit 7404ed6

Browse files
committed
portier: allow setting localized names
1 parent 0f5ae81 commit 7404ed6

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/pages/Devices.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import DeviceActionButton from '../widgets/DeviceActionButton/DeviceActionButton
88
import ErrorMessage from '../widgets/ErrorMessage.tsx';
99
import {useVariantName} from '../hooks/useVariant.ts';
1010
import type {PortierDevice} from "../portier-types";
11+
import { useLocale } from "../hooks/useLocale.ts";
1112

1213
const Devices = ({
1314
deviceGroup,
1415
deviceActionMapper,
1516
}: { deviceGroup: string, deviceActionMapper: (d: PortierDevice) => string[] }) => {
1617
const {t} = useTranslation();
18+
const [locale] = useLocale();
1719

1820
const {
1921
data: devices,
@@ -43,7 +45,7 @@ const Devices = ({
4345
<Card border="secondary">
4446
<Card.Header
4547
className={'text-start' + (variantName === "initlab" ? ' bg-primary text-light' : '')}>
46-
{device.name}
48+
{locale ? (device.localized_names[locale] ?? device.name) : device.name}
4749
</Card.Header>
4850
<Card.Body
4951
className="d-flex flex-column flex-lg-row justify-content-center align-items-center gap-4">

src/portier-types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export type PortierDevice = {
66
number: number,
77
public: boolean,
88
supported_actions: string[],
9+
localized_names: {[lang: string]: string },
910
statuses: { [status: string]: string | boolean },
1011
};
1112

0 commit comments

Comments
 (0)