#Navigate using Link on Next-intl ?

9 messages · Page 1 of 1 (latest)

wicked dew
#

Hey guys, im struggling on how to use the current language to navigate dynamiclay through my app.
Can't use ${pathname} on Link, any ideas ?

import { useRouter, locales, localePrefix } from "../navigation";
import { useParams } from "next/navigation";
export default function Navigation() {
  const params = useParams();

  console.log(params);
  console.log(locales);
  console.log(localePrefix);

  // const params = useParams();
  // console.log(params);

  return (
    <>
      <div className=" h-32 w-full flex lg:bg-white justify-between lg:justify-around bg-black lg:pr-12 overflow-y-hidden">
        <div className="w-full h-full hidden lg:flex justify-evenly">
          <div className="flex items-center w-5/12">
            <div className="flex  text-xl w-full justify-evenly font-light">
              <Link href="/">
                <span>Home</span>
              </Link>
              <Link href={`/${params}/services` }> // Here //
                <span>Services</span>
              </Link>
              <Link href="/about">
                <span>About</span>
              </Link>
            </div>
````
warm ginkgoBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

hot seal
wicked dew
hot seal
wicked dew
#

Yeah

#

It worked

wicked dew
hot seal
#

np