import createPaths from "./createPaths"; const createCommonConfig = (locale: string, availableLocales: string[], createPath) => { const all = availableLocales.map(locale => ({ locale, url: `${createPaths.getPublicUrl()}/${createPath(locale)}` })); const others = all.filter(elem => elem.locale !== locale); const current = all.find(item => item.locale === locale); return { global: { nav: { homeUrl: `${createPaths.getPublicUrl()}/${createPaths.home(locale)}`, archiveUrl: `${createPaths.getPublicUrl()}/${createPaths.archive(locale)}` }, locale: { current, all, others } } }; }; export default createCommonConfig;