T
TanStack3y ago
vicious-gold

Localization of table headers

Is there a recommended way of using localization such as i18n for table headers?
2 Replies
optimistic-gold
optimistic-gold3y ago
i've just been working on this in my app. and came here to ask for any guidance as well by coincidence. what i've done so far is just call my translation helper when defining columns like:
columnHelper.accessor("status", {
header: t("key.for.status_column")
}
columnHelper.accessor("status", {
header: t("key.for.status_column")
}
what i'd eventually like to be able to do is enforce that a column header is translated. i have an eslint rule for enforcing no un-localized strings in jsx/templates, but this won't catch column headers
vicious-gold
vicious-goldOP3y ago
We've done it in a similar way, but the problem we're having is that when memoizing the table definition "t" cannot be put as a dependency since it is unstable and recreated on every render, which means the table definition is as well. Not sure how big of a problem this is in v8, in v7 memoization was recommended in the docs

Did you find this page helpful?