UNPKG

1.68 kBTypeScriptView Raw
1/// <reference types="node" />
2import { IncomingMessage, ServerResponse } from "http";
3import * as UrlParser from 'url';
4export interface ExtendedRequest extends IncomingMessage {
5 originalUrl?: string;
6 forceLocale?: string;
7 bablic?: {
8 locale: string;
9 proxied?: boolean;
10 };
11}
12export interface ExtendedResponse extends ServerResponse {
13 locals?: any;
14}
15export declare type Middleware = (req: IncomingMessage, res: ServerResponse, next: () => void) => void;
16export interface KeywordMapper {
17 [locale: string]: {
18 [keyword: string]: string;
19 };
20}
21export declare function getLocaleByURL(parsedUrl: any, locale_detection: any, localeConfigs: any, cookieLocale: any, siteDefaultLocale: any, detectedLocale: any, isProxy: any, explicitLocale: any, subDirBase: any, folders: any, locales: any): any;
22export interface SiteMeta {
23 localeDetection: string;
24 original: string;
25 customUrls: {
26 [locale: string]: string;
27 };
28 default: string;
29 autoDetect: boolean;
30 localeKeys: string[];
31 timestamp: number;
32 includeQueryString: boolean;
33 includeHash: boolean;
34 singlePageApp: boolean;
35 qsParams: string[];
36 domain: string;
37 mountSubs: string[];
38}
39export interface LastModifiedByLocale {
40 [locale: string]: Date;
41}
42export interface BablicLinkOptions {
43 subDir?: boolean;
44 subDirBase?: string;
45 subDirOptional?: boolean;
46 returnFull?: boolean;
47 folders?: {
48 [locale: string]: string;
49 };
50}
51export declare function getLink(locale: string, parsed: UrlParser.Url, meta: SiteMeta, options?: BablicLinkOptions): string;