I18nLink component examples
<I18nLink />
component is based on Next.js native <Link />
component.It's an utility that automatically handles localisation and acts as a wrapper for
<Link />
. If you'd use the
<Link />
component, you'd have to provide which locale is the current locale, and build the link accordingly.That's basically what
<I18nLink />
does.This is a link going to the same page (keeps the current locale)
This is a link going to the same page (forces to switch to fr-FR
locale)
This is a link going to the same page (forces to switch to en-US
locale)
1
2
3
4
5
6
7
8
9
10
11
<I18nLink href={'/demo/built-in-utilities/i18nLink-component'}>
This is a link going to the same page (keeps the current locale)
</I18nLink>
<I18nLink href={'/demo/built-in-utilities/i18nLink-component'} locale={'fr-FR'}>
This is a link going to the same page (forces to switch to <code>fr-FR</code> locale)
</I18nLink>
<I18nLink href={'/demo/built-in-utilities/i18nLink-component'} locale={'en-US'}>
This is a link going to the same page (forces to switch to <code>en-US</code> locale)
</I18nLink>