Complete the code to import the Next.js internationalized routing feature.
import { [1] } from 'next-i18next';
The useTranslation hook is used to access translation functions in Next.js i18n setups.
Complete the code to get the current language inside a component.
const { i18n } = useTranslation();
const currentLanguage = i18n.[1];The language property gives the current active language code.
Fix the error in the translation function call to display a greeting.
const { t } = useTranslation();
return <p>{t([1])}</p>;The translation key must be a string inside quotes when passed to t().
Fill both blanks to configure Next.js to support English and Spanish locales.
module.exports = {
i18n: {
locales: [[1], [2]],
defaultLocale: 'en',
},
};English ('en') and Spanish ('es') are common locales for internationalization.
Fill all three blanks to create a translation JSON object with keys for greeting, farewell, and thanks.
{
"greeting": [1],
"farewell": [2],
"thanks": [3]
}These are common phrases used in translations for greeting, farewell, and thanks.