/**
 * @type {import('next-i18next').UserConfig}
 */

const i18n = process.env.NEXT_PUBLIC_I18N === 'true'
const isLocal = process.env.NEXT_PUBLIC_LOCAL === 'true'
const isEN = process.env.NEXT_PUBLIC_EN === 'true'

module.exports = {
    debug: process.env.NODE_ENV === 'development',
    i18n: {
        defaultLocale: isLocal ? (isEN ? 'en-US' : 'zh-CN') : i18n ? 'en-US' : 'zh-CN',
        locales: ['zh-CN', 'en-US'],
        localeDetection: false,
        domains: [
            {
                domain: 'www.weshop.com',
                defaultLocale: 'zh-CN',
                locales: ['zh-CN'],
            },
            {
                domain: 'www.weshop.ai',
                defaultLocale: 'en-US',
                locales: ['en-US'],
            },
        ],
    },

    localePath:
        // eslint-disable-next-line @typescript-eslint/no-var-requires
        typeof window === 'undefined' ? require('path').resolve('./public/locales') : '/locales',

    reloadOnPrerender: process.env.NODE_ENV === 'development',
}
