Files
Elydora-Open-Source/packages/server/src/middleware/i18n.ts
T
雷电芽衣 bc6983a62e chore(oss): audit the server package and resync the SDK mirrors
Split the 657-line operation service into eor, submit, and verify
modules, add the AGENT_REVOKED and KEY_RETIRED codes the Backend already
emits, and condense every multi-line comment. Mirror Node, Python, and
Go at 2.1.0 with the deep-health 503, non-idempotent retry, rotation
grace, and path-encoding fixes. Document which routes and response
fields the self-hosted server does not provide.

Claude-Session: https://claude.ai/code/session_01Agoc9bRVE9KL7mmWtey9Vq
2026-09-03 20:48:20 -04:00

16 lines
495 B
TypeScript

/** i18n middleware: language detection from Accept-Language header. */
import type { MiddlewareHandler } from 'hono';
import type { Env, AppVariables } from '../types.js';
import { detectLanguage } from '../i18n/messages.js';
export const i18nMiddleware: MiddlewareHandler<{
Bindings: Env;
Variables: AppVariables;
}> = async (c, next) => {
const acceptLanguage = c.req.header('Accept-Language');
const lang = detectLanguage(acceptLanguage);
c.set('lang', lang);
await next();
};