"use client";
import React, { PropsWithChildren } from "react";

import Link from "next/link";
import { useLocale } from "next-intl";

type props = {
  href: string;
  className?: string;
};

export default function LocalePath({
  href,
  className = "",
  children,
}: PropsWithChildren<props>) {
  const locale = useLocale();

  return (
    <Link
      prefetch={true}
      className={className}
      href={`${locale === "en" ? `/${locale}${href}` : `${href}`}`}
    >
      {children}
    </Link>
  );
}
