22 lines
497 B
Plaintext
22 lines
497 B
Plaintext
---
|
|
import { l, astroI18n } from "astro-i18n";
|
|
|
|
// get the locale currently in use
|
|
const currentLocale = astroI18n.langCode;
|
|
// get all the locales available on the website and remove the one currently in use
|
|
const availableLocales = astroI18n.langCodes.filter(
|
|
(locale) => locale !== currentLocale
|
|
);
|
|
---
|
|
|
|
<ul role="list">
|
|
{
|
|
// create a list of available alternative locale
|
|
availableLocales.map((locale) => (
|
|
<li>
|
|
<a href={l("/", {}, "", locale)}>{locale}</a>
|
|
</li>
|
|
))
|
|
}
|
|
</ul>
|