www/next.config.js
mauro-balades 5779ea88ef feat: Update i18n configuration and add support for additional languages
The code changes include:
- Updating the i18n configuration to export the `SUPPORTED_LANGUAGES` array.
- Refactoring the `getRequestConfig` function to accept a `locale` parameter.
- Simplifying the logic for determining the `locale` based on the `accept-language` header.
- Loading the appropriate messages file based on the `locale` parameter.

This commit improves the i18n functionality of the project and allows for easier addition of new languages.
2024-09-02 18:56:43 +02:00

48 lines
1.3 KiB
JavaScript

const createNextIntlPlugin = require('next-intl/plugin');
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants')
const withNextIntl = createNextIntlPlugin();
/** @type {import('next').NextConfig} */
const nextConfig = (phase, { defaultConfig }) => {
const defaultConfigWWW = {
images: {
remotePatterns: [
{
protocol: "https",
hostname: "raw.githubusercontent.com",
},
{
protocol: "https",
hostname: "cdn.jsdelivr.net",
port: '',
pathname: '/gh/zen-browser/**',
}
],
domains: ['localhost', 'cdn.jsdelivr.net', "raw.githubusercontent.com"], // Allow images from jsDelivr
},
experimental: {
serverActions: {
// edit: updated to new key. Was previously `allowedForwardedHosts`
allowedOrigins: ["localhost:3000", "get-zen.vercel.app"],
},
},
compiler: {
styledComponents: true,
},
};
if (phase === PHASE_DEVELOPMENT_SERVER) {
return {
...defaultConfigWWW,
// development only config options here
};
}
return {
...defaultConfigWWW,
// production only config options here
output: 'export',
};
};
module.exports = {...withNextIntl(nextConfig), output: 'export'};