MultipleLanguage
Usage
import { useTranslations } from "next-intl";
export default function MyClientComponent() {
const t = useTranslations();
return <div>{t("hello")}</div>;
}
Translations
Translations are defined in the src/translations folder. The default locale is en and the translations are stored in en.json.
Add a new locale
- next.config.js add Language
- LanguageSwitcher add Language (LANGUAGES)
- To add a new locale you need to create a new file in the src/translations eg: fr.json for French.
{
"hello": "Bonjour le monde!"
}