import { getRequestConfig } from 'next-intl/server' import { headers } from 'next/headers' export default getRequestConfig(async () => { // This will be called for each request and determines // which locale to use based on the URL const headersList = await headers() const pathname = headersList.get('x-pathname') || '' // Extract locale from pathname (e.g., /en/bible -> en) const segments = pathname.split('/') const locale = segments[1] || 'ro' // Default to Romanian // Validate that the locale is supported const supportedLocales = ['en', 'ro'] const finalLocale = supportedLocales.includes(locale) ? locale : 'ro' return { locale: finalLocale, messages: (await import(`../messages/${finalLocale}.json`)).default } })