UNPKG

@astrolicious/i18n

Version:

Yet another i18n integration for Astro with server and client utilities, type safety and translations built-in.

3 lines 816 B
import{AstroError as n}from"astro/errors";var i=new Set(["404","500"]),a=t=>{let r=t;r.endsWith("/")&&(r=r.slice(0,-1));let o=r.split("/").pop()??"";return i.has(o)},m=t=>t.issues.map(o=>` ${o.path.join(".")} ${`${o.message}.`}`).join(` `),p=t=>new n(t,"Please open an issue on GitHub at https://github.com/astrolicious/i18n/issues"),c=({segments:t})=>`/${t.map(o=>o.map(e=>e.dynamic?`[${e.content}]`:e.content).join("")).join("/")}`,u=t=>t?Array.isArray(t)?t:Object.entries(t).map(([r,o])=>({locale:r,params:o})):[],f=(t,r)=>r.trailingSlash==="never"?t:r.build.format==="directory"&&!t.endsWith("/")?`${t}/`:t;export{p as createImpossibleError,m as formatConfigErrorMessage,c as getPathnameFromRouteData,f as handleTrailingSlash,a as isStatusCodePage,u as normalizeDynamicParams}; //# sourceMappingURL=utils.js.map