T
TanStack2y ago
sensitive-blue

Use translations in table cells

Hello, I have the following problem: I use several languages in my app. How can I transfer translations to table cells? The corresponding translation file is loaded in the page component and transferred to components accordingly. However, the translations are not part of the data structure for the table. How can I read the dict property within a cell?
const PersonsTable = (props: { persons: any, dict: any }) => {
const table = useReactTable({
data: props.persons,
columns,
getCoreRowModel: getCoreRowModel(),
})

[...]
const PersonsTable = (props: { persons: any, dict: any }) => {
const table = useReactTable({
data: props.persons,
columns,
getCoreRowModel: getCoreRowModel(),
})

[...]
columnHelper.accessor('role', {
id: 'role',
cell: info => <BadgeRole role={info.getValue()} dict={props.dict} />,
header: () => { dict.role.label },
footer: () => "Rolle",
}),
columnHelper.accessor('role', {
id: 'role',
cell: info => <BadgeRole role={info.getValue()} dict={props.dict} />,
header: () => { dict.role.label },
footer: () => "Rolle",
}),
Thanks for the help!
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?