Implement Phase 1 of i18n spec: - Configure next-intl with 6 locales (pt, en, es, fr, de, zh-CN) and pathnames - Move routes to app/[locale] structure with localized layouts and metadata - Add middleware for root language negotiation (307), legacy redirects (308), and 404 for non-pt book - Implement language selector dropdown in header with cookie persistence - Add system typography rules for zh-CN and word-break/hyphenation for de/fr Co-Authored-By: Antigravity <noreply@google.com>
27 lines
573 B
JavaScript
27 lines
573 B
JavaScript
import { getRequestConfig } from "next-intl/server";
|
|
import { hasLocale } from "next-intl";
|
|
import { routing } from "./routing";
|
|
|
|
export default getRequestConfig(async ({ requestLocale }) => {
|
|
let locale = await requestLocale;
|
|
if (!locale || !hasLocale(routing.locales, locale)) {
|
|
locale = routing.defaultLocale;
|
|
}
|
|
|
|
let messages = {};
|
|
try {
|
|
messages = (await import(`../messages/${locale}.json`)).default;
|
|
} catch {
|
|
try {
|
|
messages = (await import("../messages/pt.json")).default;
|
|
} catch {
|
|
messages = {};
|
|
}
|
|
}
|
|
|
|
return {
|
|
locale,
|
|
messages,
|
|
};
|
|
});
|