"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const moment_1 = __importDefault(require("moment"));
const i18next_1 = __importDefault(require("./i18next"));
const next_config_1 = require("../next.config");
const defaultLanguage = next_config_1.env.DEFAULT_LANGUAGE;
const allLanguages = next_config_1.env.LANGUAGES;
const otherLanguages = allLanguages.filter(lang => lang !== defaultLanguage);
const isDev = process.env.NODE_ENV === 'development';
allLanguages.forEach(async (lang) => {
    moment_1.default.updateLocale(lang, await Promise.resolve().then(() => __importStar(require(`../public/locales/${lang}/moment.json`))));
});
const nextI18Next = new i18next_1.default({
    localePath: next_config_1.env.LOCALE_PATH,
    browserLanguageDetection: !isDev,
    serverLanguageDetection: !isDev,
    cleanCode: true,
    defaultLanguage,
    otherLanguages,
    localeSubpaths: otherLanguages.reduce((prev, curr) => {
        prev[curr] = curr;
        return prev;
    }, {})
});
exports.default = nextI18Next;
exports.i18n = nextI18Next.i18n, exports.appWithTranslation = nextI18Next.appWithTranslation, exports.withTranslation = nextI18Next.withTranslation, exports.useTranslation = nextI18Next.useTranslation, exports.Router = nextI18Next.Router, exports.Link = nextI18Next.Link, exports.Trans = nextI18Next.Trans;
