mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
feat(website/i18n): highlight current language
This commit is contained in:
@@ -8,10 +8,13 @@ import { Link } from "./Button.js";
|
|||||||
import { LOCALES, swapLocaleInUrl } from "../i18n";
|
import { LOCALES, swapLocaleInUrl } from "../i18n";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useLocation } from "preact-iso";
|
import { useLocation } from "preact-iso";
|
||||||
|
import { useContext } from "preact/hooks";
|
||||||
|
import { LocaleContext } from "..";
|
||||||
|
|
||||||
export default function Footer() {
|
export default function Footer() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { url } = useLocation();
|
const { url } = useLocation();
|
||||||
|
const currentLocale = useContext(LocaleContext);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer>
|
<footer>
|
||||||
@@ -28,7 +31,9 @@ export default function Footer() {
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<nav class="languages">
|
<nav class="languages">
|
||||||
{LOCALES.map(locale => (
|
{LOCALES.map(locale => (
|
||||||
<Link href={swapLocaleInUrl(url, locale.id)}>{locale.name}</Link>
|
locale.id !== currentLocale
|
||||||
|
? <Link href={swapLocaleInUrl(url, locale.id)}>{locale.name}</Link>
|
||||||
|
: <span className="active">{locale.name}</span>
|
||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user