@astrolicious/i18n
Version:
Yet another i18n integration for Astro with server and client utilities, type safety and translations built-in.
2 lines • 572 B
JavaScript
var e=t=>"slug"in t?t.slug:t.id,c=t=>{let n=t.split("/");if(n.length<2)throw new Error(`The slug "${t}" does not match the correct format "[locale]/[...parts]"`);let[r,...o]=n;return{locale:r,slug:o.join("/")}},u={byLocale:(t,{locale:n})=>{let r=e(t);return c(r).locale===n},matchingEntries:(t,{key:n,currentEntry:r,locale:o,defaultLocale:y})=>{let i=e(t),l=e(r),s=t.data[n];if(o===y)return i===l?!0:s?e(s)===l:!1;let a=r.data[n];return a?i===e(a)?!0:s?e(s)===e(a):!1:!1}};export{u as collectionFilters,c as handleI18nSlug};
//# sourceMappingURL=content-collections.js.map