Open ali-hellani opened 3 years ago
You can use the getT on Node.js:
import getT from 'next-translate/getT'
// ...
export async function getStaticProps({ locale }) {
const t = await getT(locale, 'common')
const title = t('title')
return { props: { title } }
}
How do you load the locale from this context?
locale
is provided inside getStaticProps
arguments by Next.js
I have implemented this in _app.js file
the goal is to store the function in node.js global to use it anywhere without importing it every time i want the
t
function.My question here is it okay to do that or it will put me into troubles later on? am i missing something?
Note: new to Next.js world