@intl-t/next
Version:
A Fully-Typed Object-Based i18n Translation Library for Next.js
16 lines (15 loc) • 567 B
JavaScript
"use client";
import { jsx as _jsx } from "react/jsx-runtime";
import { resolveHref } from "@intl-t/tools/resolvers";
import NL from "next/link";
import { useLocale, usePathname } from "./router";
export function LC({ href = "", locale, currentLocale,
// @ts-ignore
config = this || {}, Link = config.Link || NL, ...props }) {
if (!href && locale)
href = usePathname();
// @ts-ignore
config.getLocale ||= () => useLocale()[0];
href = resolveHref(href, { ...config, locale, currentLocale });
return _jsx(Link, { href: href, ...props });
}