diff --git a/client/src/pages/filaments/list.tsx b/client/src/pages/filaments/list.tsx index 7be2c0c29..168e7231a 100644 --- a/client/src/pages/filaments/list.tsx +++ b/client/src/pages/filaments/list.tsx @@ -28,6 +28,11 @@ interface IFilamentCollapsed extends Omit { "vendor.name": string | null; } +function translateColumnI18nKey(columnName: string): string { + columnName = columnName.replace(".", "_"); + return `filament.fields.${columnName}`; +} + const namespace = "filamentList-v2"; export const FilamentList: React.FC = () => { @@ -125,7 +130,7 @@ export const FilamentList: React.FC = () => { menu={{ items: allColumns.map((column_id) => ({ key: column_id, - label: t(`filament.fields.${column_id.replace(".", "_")}`), + label: t(translateColumnI18nKey(column_id)), })), selectedKeys: showColumns, selectable: true, diff --git a/client/src/pages/spools/list.tsx b/client/src/pages/spools/list.tsx index 5fce1b969..27af49066 100644 --- a/client/src/pages/spools/list.tsx +++ b/client/src/pages/spools/list.tsx @@ -34,6 +34,13 @@ interface ISpoolCollapsed extends ISpool { "filament.material"?: string; } +function translateColumnI18nKey(columnName: string): string { + columnName = columnName.replace(".", "_"); + if (columnName === "combined_name") columnName = "filament_name"; + else if (columnName === "filament_material") columnName = "material"; + return `spool.fields.${columnName}`; +} + const namespace = "spoolList-v2"; export const SpoolList: React.FC = () => { @@ -179,9 +186,9 @@ export const SpoolList: React.FC = () => { ({ - key: column, - label: t(`spool.fields.${column.replace(".", "_")}`), + items: allColumns.map((column_id) => ({ + key: column_id, + label: t(translateColumnI18nKey(column_id)), })), selectedKeys: showColumns, selectable: true,