Files
talk-pro/node_modules/astro/dist/i18n/middleware.js
2026-05-12 16:16:03 +08:00

14 lines
485 B
JavaScript

import { getFetchStateFromAPIContext } from "../core/fetch/fetch-state.js";
import { I18n } from "../core/i18n/handler.js";
function createI18nMiddleware(i18n, base, trailingSlash, format) {
if (!i18n) return (_, next) => next();
const handler = new I18n(i18n, base, trailingSlash, format);
return async (context, next) => {
const response = await next();
return handler.finalize(getFetchStateFromAPIContext(context), response);
};
}
export {
createI18nMiddleware
};