Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
27 lines
1.2 KiB
Plaintext
27 lines
1.2 KiB
Plaintext
import initExtractionCompiler from './extractor/initExtractionCompiler.js';
|
|
import getNextConfig from './getNextConfig.js';
|
|
import { warn } from './utils.js';
|
|
import createMessagesDeclaration from './declaration/createMessagesDeclaration.js';
|
|
|
|
function initPlugin(pluginConfig, nextConfig) {
|
|
if (nextConfig?.i18n != null) {
|
|
warn("An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl.dev/examples#app-router-migration\n");
|
|
}
|
|
const messagesPathOrPaths = pluginConfig.experimental?.createMessagesDeclaration;
|
|
if (messagesPathOrPaths) {
|
|
createMessagesDeclaration(typeof messagesPathOrPaths === 'string' ? [messagesPathOrPaths] : messagesPathOrPaths);
|
|
}
|
|
initExtractionCompiler(pluginConfig);
|
|
return getNextConfig(pluginConfig, nextConfig);
|
|
}
|
|
function createNextIntlPlugin(i18nPathOrConfig = {}) {
|
|
const config = typeof i18nPathOrConfig === 'string' ? {
|
|
requestConfig: i18nPathOrConfig
|
|
} : i18nPathOrConfig;
|
|
return function withNextIntl(nextConfig) {
|
|
return initPlugin(config, nextConfig);
|
|
};
|
|
}
|
|
|
|
export { createNextIntlPlugin as default };
|