Internationalization of Metadata & Route Handlers in Next.js 13
There are two APIs in Next.js where you might need to apply internationalization outside of React components:
For these cases, you can use the core library from next-intl.
💡
If you're using the next-intl Server Components beta version, you can use a set of new APIs that automatically pick up your request configuration.
app/[locale]/layout.tsx
import {createTranslator} from 'next-intl';
 
export async function generateMetadata({params: {locale}}) {
  const messages = (await import(`../../../messages/${locale}.json`)).default;
 
  // You can use the core (non-React) APIs when you
  // have to use next-intl outside of components.
  const t = createTranslator({locale, messages});
 
  return {
    title: t('LocaleLayout.title')
  };
}