using next-translate in Const #667
-
Hello, I am a basic nextjs learner, so the template I am using is getting the header Nav Links from a file called HeaderNavLinks.js, which includes:
and the index page which refers to this is like this:
my question is, how can I translate the titles in HeaderNavLinks.js? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hello vahidtakro. I use something loke this:
` const { t } = useTranslation(); |
Beta Was this translation helpful? Give feedback.
-
it works! thanks a lot! can I internationalize my markdown based blog through this package? |
Beta Was this translation helpful? Give feedback.
-
If you use the example, i think it will works!! |
Beta Was this translation helpful? Give feedback.
Hello vahidtakro. I use something loke this:
js file:
const headerNavLinks = [ { href: '/blog', title: 'namespace:homepage' } ]
and on page you can use:
`
import useTranslation from 'next-translate/useTranslation';
......
const { t } = useTranslation();
{t(link.title)} .... `...
{headerNavLinks.map((link) => (