Next.js Discord

Discord Forum

My translation file only works for 1 page

Unanswered
Cuvier’s Dwarf Caiman posted this in #help-forum
Open in Discord
Cuvier’s Dwarf CaimanOP
I am using latest nextjs 15

For some reason I am getting a problem where the translation for my homepage works perfectly fine however for the about section it does not I used the exact same logic what could be causing this? I will leave screenshots too and the code.

Code for my file will be left in comments.

22 Replies

Cuvier’s Dwarf CaimanOP
'use client'

import { useTranslations } from 'next-intl'

export default function AboutPage() {
  const t = useTranslations('About')

  return (
    <div className="font-montserrat text-sm">
      {/* Imagem de fundo fixa */}
      <div
        className="fixed inset-0 -z-10 bg-cover bg-center"
        style={{ backgroundImage: "url('/background1.png')" }}
      />

      {/* Bloco branco claro e texto suave */}
      <div className="relative z-10 bg-neutral-50 flex flex-col items-center justify-center px-6 py-12 text-neutral-700 text-center space-y-5">
        <h1 className="text-2xl md:text-4xl font-semibold mb-8 text-gray-600 mt-20 mb-15">
          {t('title')}
        </h1>
        <p className="max-w-2xl text-sm md:text-base text-gray-600 mb-15">
          {t('intro')}
        </p>
      </div>

      {/* Retângulo transparente */}
      <div className="relative z-10 w-full py-52 text-center text-white/90" />

      {/* Texto + imagem */}
      <div className="relative z-10 bg-neutral-50 flex flex-col md:flex-row items-center justify-center px-6 py-20 gap-12 text-neutral-700">
        <div className="max-w-2xl text-sm md:text-base leading-relaxed space-y-4">
          <p>{t('paragraph1')}</p>
          <p>{t('paragraph2')}</p>
        </div>

        <div className="w-full max-w-xs">
          <img
            src="/daniela1.JPG"
            alt="Daniela portrait"
            className="w-full h-auto object-cover rounded-lg shadow-md"
          />
        </div>
      </div>
    </div>
  )
}

This is the code for the about page.
could you show your json file
@Yi Lon Ma could you show your json file
Cuvier’s Dwarf CaimanOP
there ya go bud
He is just not locating for some reason the about key
i dont understand but its also the first time i do a page with multiple languages
because you're using About.title which doesn't exist in your json file
Cuvier’s Dwarf CaimanOP
sorry
Wrong code
its the same one :derp:
Cuvier’s Dwarf CaimanOP
sorry again XD
this is the right one
did you try restarting your devserver?
Cuvier’s Dwarf CaimanOP
on the console right?
yea
Cuvier’s Dwarf CaimanOP
yea sure
i stop and run it again
but i get the same result
could it be cache?
i can show the files for the translation?
idk if it helps
wait a min
im a fucking idiot